David wrote: > ro wrote: >>> You could also do something like:. >>> >>> ${display_pages(current_page and current_page.sub_pages or >>> space.root_pages)} >>> >> It is very cool. >> Which document introduce the syntax like this? >> > This isn't strictly Kid syntax. It is Python itself. Inside of the ${} > you are able to you arbitrary Python expressions.
We should also mention that in Python 2.5 you can now write ${display_pages( current_page.sub_pages if current_page else space.root_pages)} It does the same as above but it will also work in the case when current_page.sub_pages is false, and it is more readable. See http://docs.python.org/whatsnew/pep-308.html for details. -- Chris ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ kid-template-discuss mailing list kid-template-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kid-template-discuss