On 1/29/07, iain duncan <[EMAIL PROTECTED]> wrote:
>
>
> > > >
> > > > use &lt; as your <, or reverse the operators and make it so it's
> > > > always doing a greater than operation.  This is even more fun when
> > > > you're dealing with javascript less than operations.
> > >
> > > So if I use &lt in the python expression, that gets converted *before*
> > > the python code runs?
> >
> > It doesn't get "converted"... that's just how XML works. Kid templates
> > are valid XML documents and are parsed as such.
> >
> > -bob
>
> Ok, so when we use <?py some code ?>, the code can contain those signs,
> but can do no ouput correct?

The semantics for XML processing instructions are different than
attributes. Doesn't really have anything to do with Kid.

> Obviously my understanding of xml parsing was way off, anyone have any
> tips on how they would tackle the original problem then? I want an
> attribute set by a conditional expression from python, preferably
> without having to make a whole conditional tag or element:
>
> <div py:for="thing in things"
> my_attrib="pseudocode: x if thing.depth > 1 else y" >

Personally I'd use "thing.depth > 1 and x or y", carefully making sure
that x is not False. If it is, you could do something like:
"(thing.depth > 1 and [x] or [y])[0]" which is both short-circuiting
and non-False, just ugly.

-bob

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to