[Zope3-Users] How can I determine (in code) if the instance is running in devmode or not?

Marius Gedminas mgedmin at b4net.lt
Fri May 30 06:12:21 EDT 2008


On Wed, May 28, 2008 at 04:45:13PM +0200, Andreas Johnsen wrote:
> I want to insert some extra HTML from a viewlet manager when running in
> devmode. How can I determine (in code) if the instance is running in
> devmode or not?

    from zope.app.appsetup.appsetup import getConfigContext

    def is_devmode_enabled():
        """Is devmode enabled in zope.conf?"""
        config_context = getConfigContext()
        return config_context.hasFeature('devmode')

Regards,
Marius Gedminas
-- 
"Don't trust a statistic you haven't faked yourself."
	-- Seen in another posting by Markus Kuhn
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mail.zope.org/pipermail/zope3-users/attachments/20080530/cd187b9d/attachment.bin


More information about the Zope3-users mailing list