[Zope] Re: [Zope-dev] getting a dtmlfile from ZODB instead of the file system.

Lennart Regebro lennart@regebro.nu
Wed, 23 Jan 2002 20:14:47 +0100


From: "Romain Slootmaekers" <romain@zzict.com>
> The problem i have is that the forms for management are always created on
> the file system, like this:
>
> index_html = DTMLFile('www/index_html', globals())
>
> I really would like the index_html file to come from the ZODB instead of
> the file system, so how do I do that?

You create a DTMLMethod called index_html.
Either manually, or like so:

path = os.path.join(os.path.split( __file__)[0], 'dtml')
self.addDTMLMethod('index_html', '', open(os.path.join(path,
'index_html.dtml' )))

This assumes your object is an object manager. It will create an index_html
DTMLMethod and the default contents of this DTMLMethod will be what is in
the dtml/index_html.dtml file.