At 12:32 PM 3/4/99 -0500, you wrote:
On Thu, 4 Mar 1999, Michel Pelletier wrote:
When your debugging your DTML, it's a pain to keep deleting and creating new instances of your object in order to load the new dtml files off of the disk. This function comes in handy:
def refresh_docs(self, REQUEST): """ refresh documents from disk (for debug purposes) """
for id,title in self.defaultDocs: try: self._delObject(id) except: pass try: self.defaultDocFile(id, title, id) except: pass return self.manage_main(self, REQUEST)
I think Skip provided a better way to deal with this, but I am not sure if it has made it in the official DocumentTemplate release.
Michel's use of a debug flag is cool. Only, are you aware of Z_DEBUG_MODE (aka BOBO_DEBUG_MODE, aka __bobo_debug_mode__)? It's purpose is exactly things like this. It gives more informative errors, and should make all objects that care operate in debug mode. For example, I believe that HTMLFiles should check for this and reload it's content if it is set. Check out this snippet of code from Main.py for n in 'Z', 'BOBO': if os.environ.has_key('%s_DEBUG_MODE' % n): n=string.lower(os.environ['%s_DEBUG_MODE' % n]) if n=='no' or n=='off': continue try: n=string.atoi(n) except: pass if n: Globals.DevelopmentMode=1 Now you know how to check for debug mode in your own objects, check for 'DevelopmentMode' -Amos