On Mon, 2007-29-01 at 05:54 -0800, Joseph Tate wrote:
>
> iain duncan wrote:
> > Hi folks, I found this handy cheat on line to make do without ternary
> > operators until py 2.5 is readily available on commodity hosting:
> >
> > ( answer1, answer2 )[ boolean_condition ]
> > - evaluates to answer2 if boolean_condition true, else answer1
>
> I always use (boolean_condition and answer1 or answer2). I.e. for
> py:attrs="{'checked': value==7 and 'checked' or None}" for your
> checkboxes.
>
> > The <= makes kid choke on a bad tag. Seems to me kid should recognize
> > that <>'s inside a py expression should be ignored. Which if does for >=
> > but *not* <=.
> >
> > The bottom of the traceback I get is:
> >
> > File "/usr/lib/python2.4/site-packages/kid-0.9.3-py2.4.egg/kid/pull.py",
> > line 414, in feed
> > raise e
> > ExpatError: not well-formed (invalid token): line 77, column 81
> >
>
> use < 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 < in the python expression, that gets converted *before*
the python code runs?
Thanks for all the tips folks
Iain
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---