Adding a ZPT when adding product instance
I use something like this to add a DTML Method inside of my folderish product: # Add default interface index_html = HTMLFile('dtml/index_html', globals()) text = index_html.read_raw() ob.manage_addDTMLMethod(id='index_html', title='') idx = ob.index_html idx.manage_edit(text, title='') the source for the index_html file is in the dtml folder in my product, and is called index_html.dtml Is this the correct Zope idiom? How can I do something similar for ZPT? _________________________________________________________________ Help STOP SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail
Lee Harr wrote at 2004-1-9 15:02 +0000:
I use something like this to add a DTML Method inside of my folderish product:
# Add default interface index_html = HTMLFile('dtml/index_html', globals()) text = index_html.read_raw() ob.manage_addDTMLMethod(id='index_html', title='') idx = ob.index_html idx.manage_edit(text, title='')
the source for the index_html file is in the dtml folder in my product, and is called index_html.dtml
Is this the correct Zope idiom? How can I do something similar for ZPT?
It is similar for ZPT. ZPT use the "official" creation method (not an abbreviated form like DTML). It looks like: ob.manage_addProduct['PageTemplates'].manage_addPageTemplate( id, title, text) "PageTemplateFile" is the correspondence for "HTMLFile". However, I would directly read the file content (with Python's "open" followed by "read") and pass it as "text" to the constructor. -- Dieter
participants (2)
-
Dieter Maurer -
Lee Harr