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<br><br> <publisher<br> name="LAZRWS"<br> factory=".root.WSFactory"<br>
methods="GET POST HEAD DELETE"<br> mimetypes="*"<br> priority="5"<br> /><br><br>Priority is set to 5 as opposed to priority 10 of the standard BROWSER declaration in zope/app/publication/configure.zcml<br>
<br> <publisher<br> name="BROWSER"<br> factory=".requestpublicationfactories.BrowserFactory"<br> methods="GET POST HEAD"<br> mimetypes="*"<br> priority="10"<br>
/><br><br>But although the RequestPublicationFactory class say:<br><br> "The `priority` is used to define a lookup-order when multiple factories<br> are registered for the same method and mime-type."<br>
<br>the RequestPublicationFactory.lookup does not really take that into account.<br>So what I did on line 104 of zope/app/publication/requestpublicationregistry.py<br><br> from operator import itemgetter<br> factory_lst = sorted(factory_lst, key=itemgetter('priority'))<br>
<br>Now it works as expected, calling canHandle of my factory and then falling back to ".requestpublicationfactories.BrowserFactory" for non WS requests.<br><br>Is this really a bug or should I be doing something different?<br>
<br><br>Thanks<br>Gustavo<br><br><br>