Kwissle

My real-time quiz battle game Kwissle.com

Crosstips.org

My fun Crossword solver project. Crosstips.org & Krysstips.se

Kung Fu

Fujian White Crane Kung Fu

Photos

Photoalbum, both old and new.

Twitter

Follow me on Twitter

Contact me

My contact details and how to contact me.

 

KungFuPeople.com
Do you train Kung Fu?
Or know someone who does?
Then check out KungFuPeople.com


Mobile version of this page Mobile version of this page


 
Zope

Zope in DevelopmentMode


26th of June 2005

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.



Comment

 
Name:
Email:
hide my email address.

Your email address will be encoded to prevent email-extraction spiders from reading it so you won't get spammed if you decide to show your email address.