Hi, I'm new to Zope and while 'playing' around I wondered about the following: I've created a DTML method (called MyListFiles) that lists the 'File' objects contained in a folder: <ul> <dtml-in "objectValues('File')"> <li><a href="<dtml-var absolute_url>"><dtml-var id></a></li> </dtml-in> </ul> This works as expected when I run it using the 'View' tab. Now when I create a DTML document and call this method like this: <dtml-var MyListFiles> it produces no output. Why? Thank You for any help --------------------- Un courrier �lectronique n'engage pas son �metteur. Tout message susceptible de comporter un engagement doit �tre confirm� par un �crit d�ment sign�. An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. Ein elektronischer Brief bzw. eine elektronische Nachricht ist f�r den Absender nicht verbindlich. Jede Nachricht, welche eine Verpflichtung beinhaltet, mu� schriftlich best�tigt und ordnungsgem�� unterzeichnet werden. ---------------------
By applying your MyListFiles method within the context of your DTML Document you are asking for files that are contained by your DTML Document and there are none. By 'viewing' your method in the management interface you are applying your method within the context of the folder that contains it, and that folder apparently contains file's. If you want to use your method within a DTML Document with the very same result you could use for instance: <dtml-in "PARENTS[0].objectValues('File')"> See also: http://www.zope.org/Members/michel/HowTos/DTMLMethodsandDocsHowTo Cornelis J. de Brabander ========================================== Department of Education, Leiden University P.O.Box 9555, NL-2300 RB Leiden +31 71 527 3422/3401 brabander@fsw.leidenuniv.nl ==========================================
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Koch Marc Sent: woensdag 3 januari 2001 12:16 To: 'zope@zope.org' Subject: [Zope] objectValues Question
Hi,
I'm new to Zope and while 'playing' around I wondered about the following:
I've created a DTML method (called MyListFiles) that lists the 'File' objects contained in a folder:
<ul> <dtml-in "objectValues('File')"> <li><a href="<dtml-var absolute_url>"><dtml-var id></a></li> </dtml-in> </ul> This works as expected when I run it using the 'View' tab.
Now when I create a DTML document and call this method like this:
<dtml-var MyListFiles>
it produces no output.
Why?
Thank You for any help
---------------------
Un courrier électronique n'engage pas son émetteur. Tout message susceptible de comporter un engagement doit être confirmé par un écrit dûment signé.
An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed.
Ein elektronischer Brief bzw. eine elektronische Nachricht ist für den Absender nicht verbindlich. Jede Nachricht, welche eine Verpflichtung beinhaltet, muß schriftlich bestätigt und ordnungsgemäß unterzeichnet werden.
---------------------
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
I'm new to Zope and while 'playing' around I wondered about the following: I've created a DTML method (called MyListFiles) that lists the 'File' objects contained in a folder: <snip> Now when I create a DTML document and call this method like this: <dtml-var MyListFiles> it produces no output. Because DTML Documents are object of their own and DTML Methods are not. THis means that if you are trying to get the 'objectValues' from the DTML Method it will get them from the containing object, a Folder. If you try to get them from a DTML Document, it will not return anything, as the DTML Document holds no other objects. The solutions is to make the DTML Method call its parent's (=containing object) objectValues. For example (untested): <dtml-with expr="PARENT[0]"> <dtml-var MyListFiles> </dtml-with> Rik
participants (3)
-
Cornelis J. de Brabander -
Koch Marc -
Rik Hoekstra