zope.app.wsgi doesn't register product configurations properly

Bug #220440 reported by Hong Yuan
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zope 3
Fix Released
Undecided
Uli Fouquet
grok
Fix Released
Medium
Reinout van Rees

Bug Description

'product-config' directive in zope.conf is not working when using wsgi to start up zope3.

The config function in zope.app.wsgi is not calling setProductConfigurations to register product configuration. The following should be added to it:

from zope.app.appsetup.product import setProductConfigurations
...

def config(...)
...
   if options.product_config:
       setProductConfigurations(options.product_config)
...

Revision history for this message
Florent (florent.x) wrote :

same issue using grok 1.0a4 (zope.app.wsgi 3.4.1)

Changed in zope3:
status: New → Confirmed
Revision history for this message
Reinout van Rees (reinout) wrote :

There ought to be a (by default empty) "extra" option in the [zope_conf] template part in the buildout that you can use to add custom stuff to the end of the generated zope.conf. This immediately solves the product config problem:

[zope_conf]
recipe = ...template
...
extra =
    <productconf mythingy>
        blabla blub
    </productconf>

Would that be a decent solution?

Revision history for this message
Reinout van Rees (reinout) wrote :

My previous comment was targeted at grok: the current grokproject layout uses a template recipe to generate the zope.conf.

Changed in grok:
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
Reinout van Rees (reinout) wrote :

I'm OK with doing the template change in grokproject. I'm not touching the other zope config recipe.

Changed in grok:
assignee: nobody → Reinout van Rees (reinout)
milestone: none → 1.0
Revision history for this message
Uli Fouquet (uli-gnufix) wrote :

Sounds good. Could you make the changes to grokproject?

Is it enough to change zope.conf or are additional steps required in zope.app.wsgi or grokcore.startup?

Revision history for this message
Reinout van Rees (reinout) wrote :

I've added the 'extra' option to the [zope_conf] part in grokproject trunk, so this awaits a release of grokproject.

Changed in grok:
status: Confirmed → Fix Committed
Revision history for this message
Florent (florent.x) wrote :

AFAICT it does not solve the problem reported in the title and description above.

Actually the issue is that the section <product-config myproduct> is not parsed when using Paste.
The issue is related with zope.app.wsgi because after some investigation it appears that everything is correctly registered when using zope.app.server (or even zope.app.twisted)

Then if we compare "zope/app/server/main.py", function "setup(...)" with "zope/app/wsgi/__init__.py", function "config(...)" we see that some code is missing:
...
   if options.product_config:
       setProductConfigurations(options.product_config)
...

Or I missed something?

Revision history for this message
Reinout van Rees (reinout) wrote :

flox: I'll have to investigate that on monday. I thought it was only a config file problem, but I haven't actually tested it. I just removed the "it is fixed and committed" marker... Thanks for being vigilant about this!

Changed in grok:
status: Fix Committed → In Progress
Revision history for this message
Uli Fouquet (uli-gnufix) wrote :

I'm afraid, flox is right here.

Just checked and the product_config settings are in fact not read on startup.

We need an update of zope.app.wsgi (or grokcore.startup), I'm afraid.

Maybe there is a reason, why product configuration setup wasn't included in zope.app.wsgi. I might ask that on zope-dev.

Revision history for this message
Uli Fouquet (uli-gnufix) wrote :

Just added the required steps to zope.app.wsgi trunk and 3.4 maintenance branch.

If there are no objections from zope-dev, we could do at least a 3.4.2 release of zope.app.wsgi and update grok afterwards.

I think this could be useful also if other procedures exist for configuring apps.

Uli Fouquet (uli-gnufix)
Changed in grok:
status: In Progress → Fix Committed
Changed in zope3:
assignee: nobody → Uli Fouquet (uli-gnufix)
status: Confirmed → Fix Committed
Changed in grok:
status: Fix Committed → Fix Released
Revision history for this message
Tres Seaver (tseaver) wrote :

zope.app.wisgi 3.6.1 includes this fix:

  http://pypi.python.org/pypi/zope.app.wsgi/3.6.1

Changed in zope3:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.