Commit c1b9b0e5 authored by Hanno Schlichting's avatar Hanno Schlichting

Assorted fixes

parent 4451e49e
...@@ -28,8 +28,7 @@ from BTrees.OIBTree import OIBTree ...@@ -28,8 +28,7 @@ from BTrees.OIBTree import OIBTree
from BTrees.IOBTree import IOBTree from BTrees.IOBTree import IOBTree
from Lazy import LazyMap, LazyCat, LazyValues from Lazy import LazyMap, LazyCat, LazyValues
from CatalogBrains import AbstractCatalogBrain, NoBrainer from CatalogBrains import AbstractCatalogBrain, NoBrainer
from .CatalogReport import CatalogReport
from CatalogReport import CatalogReport
LOG = logging.getLogger('Zope.ZCatalog') LOG = logging.getLogger('Zope.ZCatalog')
...@@ -86,7 +85,7 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -86,7 +85,7 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base):
self._v_brains = brains self._v_brains = brains
self.updateBrains() self.updateBrains()
def __len__(self): def __len__(self):
return self._length() return self._length()
...@@ -468,7 +467,6 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -468,7 +467,6 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base):
# Note that if the indexes find query arguments, but the end result # Note that if the indexes find query arguments, but the end result
# is an empty sequence, we do nothing # is an empty sequence, we do nothing
cr = self.getCatalogReport(request) cr = self.getCatalogReport(request)
cr.start() cr.start()
...@@ -479,9 +477,7 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -479,9 +477,7 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base):
continue continue
cr.split(i) cr.split(i)
r = _apply_index(request) r = _apply_index(request)
cr.split(i) cr.split(i)
if r is not None: if r is not None:
...@@ -491,8 +487,7 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -491,8 +487,7 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base):
break break
cr.stop() cr.stop()
if rs is None: if rs is None:
# None of the indexes found anything to do with the request # None of the indexes found anything to do with the request
# We take this to mean that the query was empty (an empty filter) # We take this to mean that the query was empty (an empty filter)
...@@ -750,16 +745,12 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -750,16 +745,12 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base):
__call__ = searchResults __call__ = searchResults
def getCatalogReport(self, request=None):
def getCatalogReport(self,request=None): """Reports about the duration of queries.
""" """
Reports about the duration of queries parent = Acquisition.aq_base(Acquisition.aq_parent(self))
""" threshold = getattr(parent, 'long_query_time', 0.1)
return CatalogReport(self, request, threshold)
threshold = getattr(self.aq_parent,'long_query_time',0.1)
cr = CatalogReport(self,request,threshold)
return cr
class CatalogSearchArgumentsMap: class CatalogSearchArgumentsMap:
......
...@@ -167,7 +167,7 @@ class CatalogReport(StopWatch): ...@@ -167,7 +167,7 @@ class CatalogReport(StopWatch):
"""Catalog report class to meassure and identify catalog queries. """Catalog report class to meassure and identify catalog queries.
""" """
def __init__(self, catalog, request=None, threshold=0): def __init__(self, catalog, request=None, threshold=0.1):
super(CatalogReport, self).__init__() super(CatalogReport, self).__init__()
self.catalog = catalog self.catalog = catalog
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment