Skip to content

Commit

Permalink
Remove RequestContainer BBB logic.
Browse files Browse the repository at this point in the history
Also be a bit more lenient in CompositeIndex speed comparision.
  • Loading branch information
hannosch committed Aug 26, 2016
1 parent bbb9dd1 commit c1163e4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
Expand Up @@ -272,10 +272,10 @@ def profileSearch(query, warmup=False, verbose=False):
(duration1 / duration2,))

if not warmup:
# if lenghth of result is greater than zero composite
# if length of result is greater than zero composite
# search must be roughly faster than default search
if res1 and res2:
assert 0.95 * duration2 < duration1, (duration2, duration1)
assert 0.9 * duration2 < duration1, (duration2, duration1)

# is result identical?
self.assertEqual(len(res1), len(res2), '%s != %s for %s' %
Expand Down
14 changes: 3 additions & 11 deletions src/Products/ZCatalog/CatalogBrains.py
Expand Up @@ -18,13 +18,7 @@
from Record import Record
from zope.globalrequest import getRequest
from zope.interface import implements
try:
from ZPublisher.BaseRequest import RequestContainer
except ImportError:
# BBB: Zope 4 removes RequestContainer
_REQUESTCONTAINER_EXISTS = False
else:
_REQUESTCONTAINER_EXISTS = True
from ZPublisher.BaseRequest import RequestContainer

from .interfaces import ICatalogBrain

Expand Down Expand Up @@ -59,8 +53,7 @@ def _unrestrictedGetObject(self):
Same as getObject, but does not do security checks.
"""
parent = aq_parent(self)
if (aq_get(parent, 'REQUEST', None) is None and
_REQUESTCONTAINER_EXISTS):
if (aq_get(parent, 'REQUEST', None) is None):
request = getRequest()
if request is not None:
# path should be absolute, starting at the physical root
Expand All @@ -84,8 +77,7 @@ def getObject(self, REQUEST=None):
if not path:
return None
parent = aq_parent(self)
if (aq_get(parent, 'REQUEST', None) is None and
_REQUESTCONTAINER_EXISTS):
if (aq_get(parent, 'REQUEST', None) is None):
request = getRequest()
if request is not None:
# path should be absolute, starting at the physical root
Expand Down

0 comments on commit c1163e4

Please sign in to comment.