I've just started with Zope and have not programmed anything in Python (yet). I'm just exploring/learning DTML but am a bit frustrated by the lack of good tutorial (for dummy's like me). In one of the postings to this maillinglist I saw mentioned the use of the following tag <!--#var body fmt="structured-text"-->, and looked in the source code for StructuredText.py. I think I understand how to format plain text as structured text, but don't understand how to insert it in a document. Is the only possibility the use of forms ? Can somebody please give me an example. Wiebe Kunst
Wiebe Kunst wrote:
I've just started with Zope and have not programmed anything in Python (yet). I'm just exploring/learning DTML but am a bit frustrated by the lack of good tutorial (for dummy's like me). In one of the postings to this maillinglist I saw mentioned the use of the following tag <!--#var body fmt="structured-text"-->, and looked in the source code for StructuredText.py. I think I understand how to format plain text as structured text, but don't understand how to insert it in a document. Is the only possibility the use of forms ? Can somebody please give me an example.
Wiebe Kunst
Wiebe, The attribute referenced in the #var tag should be a string. I'm not sure if this is what your asking, but a good example can be seen in lib/python/App/readme.dtml and lib/python/Product/App/Product.py. In the dtml file, you'll find this usage: <!--#var manage_get_product_readme__ fmt=structured-text--> and the Python code that returns the string in Product.py: def manage_get_product_readme__(self): try: return open(os.path.join( SOFTWARE_HOME, 'Products', self.id,'README.txt' )).read() except: return '' Which just reads README.txt out of the Product dir and returns it as a string. I think what you might be looking for is a Document object you add to the management interface, that is formats its contents as structured-text. Paul recently posted a good example to the list: http://www.egroups.com/list/zope/922.html -Michel
participants (2)
-
Michel Pelletier -
Wiebe Kunst