Adding content to document types
Hello all, I'm adding documents & scripts to a folder using - context.manage_addDTMLMethod("index_html", "Index") #document name & title etc. These documents are created with default body content. My question is - how do I access/add to/replace the content that is inserted into the documents by default? For example, I'd like to insert dynamically generated code into Python scripts, or into the DTML document using properties defined within the folder. TIA. Samir.
Am Mittwoch, 5. März 2003 11:34 schrieb Samir Mishra:
Hello all,
I'm adding documents & scripts to a folder using - context.manage_addDTMLMethod("index_html", "Index") #document name & title etc.
These documents are created with default body content.
My question is - how do I access/add to/replace the content that is inserted into the documents by default? For example, I'd like to insert dynamically generated code into Python scripts, or into the DTML document using properties defined within the folder.
Have a look into the API Docs, there are methods you can use to replace the content. For DTML methods / documents -> manage_edit(data, title) for Python scripts -> ZPythonScript_edit(params, body) hth Matthias
TIA.
Samir.
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
__________________________________________________________________ Gesendet von Yahoo! Mail - http://mail.yahoo.de Bis zu 100 MB Speicher bei http://premiummail.yahoo.de
I'm adding documents & scripts to a folder using - context.manage_addDTMLMethod("index_html", "Index") #document name & title etc.
These documents are created with default body content.
My question is - how do I access/add to/replace the content that is inserted into the documents by default? For example, I'd like to insert dynamically generated code into Python scripts, or into the DTML document using properties defined within the folder.
The manage_addXXX methods generally have a parameter that you can set for content (although this is not always shown in the generated API docs.) For DTMLMethods, for instance, you can see in the source (lib/python/OFS/DTMLMethod.py) a function definition def addDTMLMethod(self, id, title='', file='', REQUEST=None, submit=None): """Add a DTML Method object with the contents of file. If 'file' is empty, default document text is used. """ which is used as 'manage_addDTMLMethod()' (this is defined in some __init__.py). So if you say data = "I am the new content. Woo hoo." context.manage_addDTMLMethod("index_html", "Index", data) # document name & title you will create an index_html titled "Index" with the content "I am the new content. Woo hoo." --jcc
participants (3)
-
J Cameron Cooper -
Matthias Hörtzsch -
Samir Mishra