[Zope-dev] possible bug in zope.app.publication

Gustavo Rahal gustavorahal at gmail.com
Mon Jun 21 09:24:33 EDT 2010


I'm trying to integrate lazr.restful into a Zope3 app and I was advised to
created my own publication factory. For that I did

  <publisher
      name="LAZRWS"
      factory=".root.WSFactory"
      methods="GET POST HEAD DELETE"
      mimetypes="*"
      priority="5"
      />

Priority is set to 5 as opposed to priority 10 of the standard BROWSER
declaration in zope/app/publication/configure.zcml

  <publisher
      name="BROWSER"
      factory=".requestpublicationfactories.BrowserFactory"
      methods="GET POST HEAD"
      mimetypes="*"
      priority="10"
      />

But although the RequestPublicationFactory class say:

    "The `priority` is used to define a lookup-order when multiple factories
    are registered for the same method and mime-type."

the RequestPublicationFactory.lookup does not really take that into account.
So what I did on line 104 of
zope/app/publication/requestpublicationregistry.py

        from operator import itemgetter
        factory_lst = sorted(factory_lst, key=itemgetter('priority'))

Now it works as expected, calling canHandle of my factory and then falling
back to ".requestpublicationfactories.BrowserFactory" for non WS requests.

Is this really a bug or should I be doing something different?


Thanks
Gustavo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope-dev/attachments/20100621/f44d0ebf/attachment.html 


More information about the Zope-Dev mailing list