[ZCM] [ZC] 1358/ 1 Request ""Zope.configure('configfile'); app = Zope.app()" no longer works"

Collector: Zope Bugs, Features, and Patches ... zope-coders-admin at zope.org
Sun May 30 20:08:19 EDT 2004


Issue #1358 Update (Request) ""Zope.configure('configfile'); app = Zope.app()" no longer works"
 Status Pending, Zope/bug medium
To followup, visit:
  http://collector.zope.org/Zope/1358

==============================================================
= Request - Entry #1 by henderj on May 30, 2004 8:08 pm

In 2.7.0 either of the following worked to create an app in a script:

import Zope; Zope.configure('/path/to/configfile'); app = Zope.app()

from Zope.Startup.run import configure;
configure('/path/to/configfile'); import Zope; app = Zope.app()

(The former is the form Chris McDonough suggests in his Plope article; the latter is from the docstring of Zope.startup.configure().)

In Zope 2.7.1b1 I get this error on calling Zope.app():

Traceback (most recent call last):
  File "..\bin\createmmdb.py", line 34, in ?
    app = Zope.app()
  File "..\lib\python\Zope\__init__.py", line 53, in app
    configure()
  File "C:\Program Files\MailManager\lib\python\Zope\Startup\run.py", line 30, i
n configure
    opts = _setconfig(configfile)
  File "C:\Program Files\MailManager\lib\python\Zope\Startup\run.py", line 47, i
n _setconfig
    handlers.handleConfig(opts.configroot, opts.confighandlers)
AttributeError: ZopeOptions instance has no attribute 'confighandlers'


The problem appears to be the addition of these lines to Zope.app():

    if bobo_application == None:
        configure()

These call configure() a second time but with no configfile specified.  Missing out the configfile I see is a new option in 2.7.1b1 and appears to assume that the ZOPE_CONFIG envvar has been set.  Indeed, my script does work if I set ZOPE_CONFIG, but this makes an explicit call of configure('path/to/configfile') redundant.

Is this a bug or a change in the API?
==============================================================




More information about the Zope-Collector-Monitor mailing list