[Zope] .dtml files
Steve Alexander
steve@cat-box.net
Wed, 12 Jul 2000 21:06:30 +0100
Daniel wrote:
> During this process I have noticed that Zope's dtml pages are stored on
> the file system as .dtml files (i.e. roleEdit.dtml) The question then is
> how does Zope display this pages??
The pages are usually accessed as attributes Python objects. They are
wrapped in a HTMLFile instance.
(Line numbers refer to latest Zope 2.2b4).
For example, see line 191 of lib/python/OFS/DTMLMethod.py:
manage_editForm=HTMLFile('documentEdit', globals())
See the source in lib/python/DocumentTemplate/DT_HTML.py for details.
The documents are read lazily.
class HTMLFile(FileMixin, HTML):
"""\
HTML Document templates read from files.
If the object is pickled, the file name, rather
than the file contents is pickled. When the object is
unpickled, then the file will be re-read to obtain the string.
Note that the file will not be read until the document
template is used the first time.
"""
--
Steve Alexander
Software Engineer
Cat-Box limited
http://www.cat-box.net