-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

ro wrote:
> hi all
>
> I have change code as this:
>
> <?python if not current_page: page_set = space.root_pages elif
> current_page: page_set = current_page.sub_pages ?>
>
> ${display_pages(page_set)}
>
> It worked, but I think it is not the best way...
>
You could also do something like:.

${display_pages(current_page and current_page.sub_pages or
space.root_pages)}

Although that is not quite as readable.

The problem is that code inside a python processing instruction is
evaluated as Python code, which is different from markup which is
streamed inline. What you did isn't bad. There are several ways of
doing what you want. Another possible alternative:

<div py:if="current_page"
py:replace="display_pages(current_page.sub_pages)"/>
<div py:if="not current_page"
py:replace="display_pages(space.root_pages)"/>

I'm sure there are some others as well.


David

- --
http://www.traceback.org

GPG keyID #6272EDAF on http://pgp.mit.edu
Key fingerprint = 8BAA 7E11 8856 E148 6833 655A 92E2 3E00 6272 EDAF
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFGQ8PhkuI+AGJy7a8RAl3hAJ4/KKwP2FJoP4m9oxw7zdvb/b/LwgCffL77
Bw3EG/TSczSgZJA+haTOexk=
=dEUt
-----END PGP SIGNATURE-----


-------------------------------------------------------------------------
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

Reply via email to