[prev in list] [next in list] [prev in thread] [next in thread]
List: zope-dev
Subject: [Zope-dev] possible bug in zope.app.publication
From: Gustavo Rahal <gustavorahal () gmail ! com>
Date: 2010-06-21 13:24:33
Message-ID: AANLkTimMRM5Z5UVgJ9rx0XJ5Tp4Bf_wMCFpxbYl_Mywf () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
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
[Attachment #5 (text/html)]
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>
_______________________________________________
Zope-Dev maillist - Zope-Dev@zope.org
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 )
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic