get dtml content from script
Hi, I have a variable called 'file' that has the name of a DTML/HTML Document tahta exist inside a Folder 'folder' I want a script to return that DTML document, which name is not known until the end of the script... Something like this: if condition: filename='file_numer1.html' else: filename='the_other_file.html' return "THE DTML CONTENT OF THE 'FILENAME', name of the file in the folder 'ONE_FOLDER'" is it possible? _______________________________________________________________ Yahoo! Messenger Nueva versión: Webcam, voz, y mucho más ¡Gratis! Descárgalo ya desde http://messenger.yahoo.es
Why dont you try the following in a dtml method: <dtml-if "condition"> <dtml-var finlenumer1.html> <dtml-else> <dtml-var thotherfile.html> <dtml-if> this is of course assuming that the files are Zope objects via a LocalFS or External File or File. If they are not and you dont have DTML content at all in them: use a <dtml-call "RESPONSE.redirect(file.html)"> instead of the dtml-var If you HAVE to use th Python script then just the boolean result of the condition to the document and then do the above. So condition above is a python script that returns a true of false. HTH AM Juan Manuel Ruiz Garcia wrote:
Hi,
I have a variable called 'file' that has the name of a DTML/HTML Document tahta exist inside a Folder 'folder'
I want a script to return that DTML document, which name is not known until the end of the script...
Something like this:
if condition: filename='file_numer1.html' else: filename='the_other_file.html'
return "THE DTML CONTENT OF THE 'FILENAME', name of the file in the folder 'ONE_FOLDER'"
is it possible?
_______________________________________________________________ Yahoo! Messenger Nueva versión: Webcam, voz, y mucho más ¡Gratis! Descárgalo ya desde http://messenger.yahoo.es
_______________________________________________ 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 )
-- ================================================================== Aseem Mohanty Neurobehavioral Systems Inc, 828 San Pablo Ave, Albany, CA 94706 (R) 510 7696011 (M) 510 3014871 (O) 510 5279231 ================================================================== "I saw `cout' being shifted "Hello world" times to the left and stopped right there!!" -- Steve Gonedes ==================================================================
Juan Manuel Ruiz Garcia writes:
I have a variable called 'file' that has the name of a DTML/HTML Document tahta exist inside a Folder 'folder' When you have an object "o" and an id "id" (a string), then you can use "o.getattr(id)" to get "o"s (own or acquired) child with id "id".
Note, that you need to call DTML objects to render them. Note that they usually require positional arguments to know about their context. Read "Calling DTML objects" in <http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html> if necessary. Dieter
participants (3)
-
AM -
Dieter Maurer -
Juan Manuel Ruiz Garcia