[Zope-dev] Zope.app() dance with 2.7

Erik A.Dahl edahl at zentinel.com
Thu Aug 7 15:26:15 EDT 2003


Chris,

I took the code from zopectl that is uses to do the debug thing and 
scripts now work.  Here is the code...

import os
if (os.environ.has_key('ZOPEVERSION') and
     os.environ['ZOPEVERSION'] == '2.7'):
     from Zope.Startup.options import ZopeOptions
     from Zope.Startup import handlers as h
     from App import config
     opts=ZopeOptions()
     
opts.configfile=os.path.join(os.environ['ZOPE_HOME'],'etc/zope.conf')
     opts.realize()
     h.handleConfig(opts.configroot,opts.confighandlers)
     config.setConfiguration(opts.configroot)
     from Zope.Startup import dropPrivileges
     dropPrivileges(opts.configroot)

You need to set ZOPEVERSION to 2.7 for it to work.  Is there a better 
way to figure out the current zope version?  It would be nice if the 
"Zope" module had a __version__ that you could check (or is there one 
somewhere else that I missed).

I'm running this against the code from cvs but I bet it would work with 
2.7.0b1

-EAD

On Thursday, August 7, 2003, at 12:18  PM, Chris Withers wrote:

> Chris McDonough wrote:
>> You can use "zopectl debug" to do this.
>
> What about when you're not debugging?
>
> What about scripts that pump stuff into Zope and the like?
>
> cheers,
>
> Chris
>
>
> _______________________________________________
> Zope-Dev maillist  -  Zope-Dev at zope.org
> http://mail.zope.org/mailman/listinfo/zope-dev
> **  No cross posts or HTML encoding!  **
> (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
> http://mail.zope.org/mailman/listinfo/zope )




More information about the Zope-Dev mailing list