On 27 January 2003, Nicola Larosa said:
> I have a dictionary called "interface". One of its fields is a list called
> "services". A PTL tries to index its first element, like this:
>
> interface["services"][0]
>
> If the PTL is of the [plain] type, it all works, but the HTML comes out all
> quoted. Look at the first half of the attached log.
>
> If the PTL is of the [html] type, which is what I use in all the rest of the
> application, I get a:
>
> TypeError: unindexable object
PTL templates that generate HTML convert all string constants to the
htmltext type. So, you should probably write
interface[str("services")][0]
to force the string constant to be a regular Python string.
(Actually, it's converted to htmltext and then back to str. So if
you're really concerned about efficiency, put this code in a regular
Python function.)
Greg
--
Greg Ward - software developer gward@mems-exchange.org
MEMS Exchange http://www.mems-exchange.org