possible bug in zope.app.publication

Gustavo Rahal <[email protected]>
Newsgroups gmane.comp.web.zope.devel
Message-ID <[email protected]>
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

_______________________________________________
Zope-Dev maillist  -  [email protected]
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.