[Zope] Correct way to load DTML Document from source file?

Piers Lauder piers@cs.su.oz.au
Fri, 23 Apr 1999 12:55:25 +1000


I'd like to load a DTML Document from source, and so far I've come
up with the following (the HTMLFile...raw is the only way I've found
to get the absolute path to a file from a Product given the last part)

                file = HTMLFile(file, globals()).raw
                try:
                        fd = open(file)
                        data = fd.read()
                        fd.close()
                except:
                        data = ''
                self.manage_addDTMLDocument(id, title, data)

My question - is there a better way?

Secondly - I'd like to load up an "index_html" if the current
Folder doesn't have one. "hasattr" will tell me if an attribute
exists locally or in the containment hierarchy - how do I test
whether an object has its own (non-aquired) attribute?