I may be overlooking the obvious, but what am I doing wrong here? <dtml-tree content branches_expr="objectValues(['Folder', 'DTML Document'])" sort=order > <dtml-if expr="meta_type == 'Folder'"> <dtml-var title_or_id> <dtml-else> <dtml-if expr="id == 'fozcoa'"><dtml-var fozgif></dtml-if> <dtml-if expr="id == 'cnart'"><dtml-var cnartgif></dtml-if> [snip stuff that generates URL] <dtml-var title_or_id></a> The tree displays, but I cannot get the images (fozgif & cnartgif) to display. There is a document inside content with the id fozcoa and another with the id cnart. -- ~mindlace
At 18:03 23-9-99 , Ethan Fremen wrote:
I may be overlooking the obvious, but what am I doing wrong here?
<dtml-tree content branches_expr="objectValues(['Folder', 'DTML Document'])" sort=order > <dtml-if expr="meta_type == 'Folder'"> <dtml-var title_or_id> <dtml-else> <dtml-if expr="id == 'fozcoa'"><dtml-var fozgif></dtml-if> <dtml-if expr="id == 'cnart'"><dtml-var cnartgif></dtml-if> [snip stuff that generates URL] <dtml-var title_or_id></a>
The tree displays, but I cannot get the images (fozgif & cnartgif) to display. There is a document inside content with the id fozcoa and another with the id cnart.
On DTML Documents, id is a method. You are comparing a method object to a string, so this will always turn out to be false. Test for id() == 'fozcoa'. -- Martijn Pieters, Web Developer | Antraciet http://www.antraciet.nl | T: +31 35 7502100 F: +31 35 7502111 | mj@antraciet.nl http://www.antraciet.nl/~mj | PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 ---------------------------------------------
Martijn Pieters wrote:
On DTML Documents, id is a method. You are comparing a method object to a string, so this will always turn out to be false. Test for id() == 'fozcoa'.
Thanks, Martijn, that works. however, if I now run this it crashes: <dtml-tree content branches_expr="objectValues(['Folder', 'DTML Document'])" sort=order > <dtml-if expr="meta_type == 'Folder'"> <dtml-var title_or_id> <dtml-else> <dtml-if expr="id() == 'cnart'"><dtml-var cnartgif></dtml-if> But I know it works because if I replace <dtml-var cnartgif> with boo the boo shows up. The image cnartgif is in the content folder. Here's the last 3 items in the traceback: File /usr/local/src/Zope-2.0.0-src/lib/python/TreeDisplay/TreeTag.py, line 250, in tpRender (Object: ElementWithAttributes) File /usr/local/src/Zope-2.0.0-src/lib/python/TreeDisplay/TreeTag.py, line 491, in tpRenderTABLE (Object: ElementWithAttributes) (Info: (['AAAAAAAAALc=', []], {'childless_decoration': '', 'id': 'tpId', 'branches_expr': <method Eval.eval of Eval instance at 85bc0e8>, 'sort': 'order', 'url': 'tpURL', 'name': 'content', '': 'content'}, [['AAAAAAAAALc=', []]], [['AAAAAAAAALc=', []]])) File /usr/local/src/Zope-2.0.0-src/lib/python/TreeDisplay/TreeTag.py, line 408, in tpRenderTABLE (Object: cnart) AttributeError: __call__ I have no idea what a 'childless decoration' is. -- ~mindlace
participants (2)
-
Ethan Fremen -
Martijn Pieters