[Checkins] SVN: Products.ZCatalog/trunk/ Forward compatibility for Zope 4 removal of RequestContainer.
Lawrence Rowe
cvs-admin at zope.org
Thu Aug 30 14:14:48 UTC 2012
Log message for revision 127625:
Forward compatibility for Zope 4 removal of RequestContainer.
Changed:
U Products.ZCatalog/trunk/CHANGES.txt
U Products.ZCatalog/trunk/src/Products/ZCatalog/CatalogBrains.py
-=-
Modified: Products.ZCatalog/trunk/CHANGES.txt
===================================================================
--- Products.ZCatalog/trunk/CHANGES.txt 2012-08-30 13:46:09 UTC (rev 127624)
+++ Products.ZCatalog/trunk/CHANGES.txt 2012-08-30 14:14:44 UTC (rev 127625)
@@ -4,6 +4,8 @@
3.0b2 (unreleased)
------------------
+- Forward compatibility for Zope 4 removal of RequestContainer.
+
- Optimize brain instantiation, by creating underlying record items in a
single step, instead of creation and three update calls.
Modified: Products.ZCatalog/trunk/src/Products/ZCatalog/CatalogBrains.py
===================================================================
--- Products.ZCatalog/trunk/src/Products/ZCatalog/CatalogBrains.py 2012-08-30 13:46:09 UTC (rev 127624)
+++ Products.ZCatalog/trunk/src/Products/ZCatalog/CatalogBrains.py 2012-08-30 14:14:44 UTC (rev 127625)
@@ -30,7 +30,13 @@
if _GLOBALREQUEST_INSTALLED:
from zope.globalrequest import getRequest
from zope.interface import implements
-from ZPublisher.BaseRequest import RequestContainer
+try:
+ from ZPublisher.BaseRequest import RequestContainer
+except ImportError:
+ # BBB: Zope 4 removes RequestContainer
+ _REQUESTCONTAINER_EXISTS = False
+else:
+ _REQUESTCONTAINER_EXISTS = True
class AbstractCatalogBrain(Record, Implicit):
@@ -64,7 +70,7 @@
"""
parent = aq_parent(self)
if (aq_get(parent, 'REQUEST', None) is None
- and _GLOBALREQUEST_INSTALLED):
+ and _GLOBALREQUEST_INSTALLED and _REQUESTCONTAINER_EXISTS):
request = getRequest()
if request is not None:
# path should be absolute, starting at the physical root
@@ -89,7 +95,7 @@
return None
parent = aq_parent(self)
if (aq_get(parent, 'REQUEST', None) is None
- and _GLOBALREQUEST_INSTALLED):
+ and _GLOBALREQUEST_INSTALLED and _REQUESTCONTAINER_EXISTS):
request = getRequest()
if request is not None:
# path should be absolute, starting at the physical root
More information about the checkins
mailing list