Imagine if you, in your code, want to find out if Zope is running in debug mode or not, then how do you do that? Here's my take on it that I learned today:


from Globals import DevelopmentMode

class MyProduct(Folder):
   def save(self, file):
       if DevelopmentMode:
           print "Saving the file now"
       self._save(file)

The example doesn't do much justice because your product code should perhaps use its own "debug mode parameter" to get greater control.

I needed this because instead of using the Auto refresh feature inside the ZMI I have a script that periodically checks for changes and does a manual refresh. When you're not in debug mode, a change to a .dtml or .zpt requires a refresh whereas when you're in debug mode it doesn't need refreshing to see the changes.

I'll try to find some later later this month to write about and share my refresh script which is something that I now can't live work without when doing Zope development.

Comments

Your email will never ever be published.

Previous:
AJAX accelerated web widgets June 23, 2005 IssueTrackerProduct
Next:
ztar - my wrapper on tar -z June 29, 2005 Python, Linux
Related by category:
'Cache-Control' or Expires September 16, 2005 Zope
To all Zope developers: Does this sound familiar? March 8, 2011 Zope
IssueTrackerProduct now officially abandoned March 30, 2012 Zope
Sending HTML emails in Zope October 26, 2006 Zope
Related by keyword:
How I make my Vite dev server experience faster October 22, 2024 Node, React, JavaScript
Local Django development with Nginx October 11, 2010 Django
Python package path when executed elsewhere December 14, 2004 Python
Pretty print SQL script August 6, 2004 Python