Back to index

plone3  3.1.7
Public Member Functions | Static Public Attributes | Private Member Functions | Static Private Attributes
CMFPlone.CatalogTool.CatalogTool Class Reference
Inheritance diagram for CMFPlone.CatalogTool.CatalogTool:
Inheritance graph
[legend]
Collaboration diagram for CMFPlone.CatalogTool.CatalogTool:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def indexObject
def catalog_object
def uncatalog_object
def getCounter
def searchResults
def clearFindAndRebuild
def manage_catalogRebuild

Static Public Attributes

 meta_type = ToolNames.CatalogTool
tuple security = ClassSecurityInfo()
string toolicon = 'skins/plone_images/book_icon.gif'
tuple manage_catalogAdvanced = DTMLFile('www/catalogAdvanced', globals())

Private Member Functions

def _removeIndex
def _listAllowedRolesAndUsers
def _increment_counter

Static Private Attributes

 _counter = None
tuple __implements__ = (PloneBaseTool.__implements__, BaseTool.__implements__)
 __call__ = searchResults

Detailed Description

Definition at line 323 of file CatalogTool.py.


Constructor & Destructor Documentation

Definition at line 334 of file CatalogTool.py.

00334 
00335     def __init__(self):
00336         ZCatalog.__init__(self, self.getId())


Member Function Documentation

Definition at line 392 of file CatalogTool.py.

00392 
00393     def _increment_counter(self):
00394         if self._counter is None:
00395             self._counter = Length()
00396         self._counter.change(1)

Here is the caller graph for this function:

def CMFPlone.CatalogTool.CatalogTool._listAllowedRolesAndUsers (   self,
  user 
) [private]
Makes sure the list includes the user's groups.

Definition at line 345 of file CatalogTool.py.

00345 
00346     def _listAllowedRolesAndUsers(self, user):
00347         """Makes sure the list includes the user's groups.
00348         """
00349         result = list(user.getRoles())
00350         if hasattr(aq_base(user), 'getGroups'):
00351             result = result + ['user:%s' % x for x in user.getGroups()]
00352         result.append('Anonymous')
00353         result.append('user:%s' % user.getId())
00354         return result

Here is the caller graph for this function:

def CMFPlone.CatalogTool.CatalogTool._removeIndex (   self,
  index 
) [private]
Safe removal of an index.

Definition at line 337 of file CatalogTool.py.

00337 
00338     def _removeIndex(self, index):
00339         """Safe removal of an index.
00340         """
00341         try:
00342             self.manage_delIndex(index)
00343         except:
00344             pass

def CMFPlone.CatalogTool.CatalogTool.catalog_object (   self,
  object,
  uid,
  idxs = [],
  update_metadata = 1,
  pghandler = None 
)

Definition at line 366 of file CatalogTool.py.

00366 
00367                        update_metadata=1, pghandler=None):
00368         self._increment_counter()
00369         # Wraps the object with workflow and accessibility
00370         # information just before cataloging.
00371         wf = getattr(self, 'portal_workflow', None)
00372         # A comment for all the frustrated developers which aren't able to pin
00373         # point the code which adds the review_state to the catalog. :)
00374         # The review_state var and some other workflow vars are added to the
00375         # indexable object wrapper throught the code in the following lines
00376         if wf is not None:
00377             vars = wf.getCatalogVariablesFor(object)
00378         else:
00379             vars = {}
00380         portal = aq_parent(aq_inner(self))
00381         
00382         w = getMultiAdapter((object, portal), IIndexableObjectWrapper)
00383         w.update(vars)
00384         
00385         ZCatalog.catalog_object(self, w, uid, idxs,
00386                                 update_metadata, pghandler=pghandler)

Here is the call graph for this function:

Here is the caller graph for this function:

Empties catalog, then finds all contentish objects (i.e. objects
   with an indexObject method), and reindexes them.
   This may take a long time.

Definition at line 426 of file CatalogTool.py.

00426 
00427     def clearFindAndRebuild(self):
00428         """Empties catalog, then finds all contentish objects (i.e. objects
00429            with an indexObject method), and reindexes them.
00430            This may take a long time.
00431         """
00432         def indexObject(obj, path):
00433             if (base_hasattr(obj, 'indexObject') and
00434                 safe_callable(obj.indexObject)):
00435                 try:
00436                     obj.indexObject()
00437                 except TypeError:
00438                     # Catalogs have 'indexObject' as well, but they
00439                     # take different args, and will fail
00440                     pass
00441         self.manage_catalogClear()
00442         portal = aq_parent(aq_inner(self))
00443         portal.ZopeFindAndApply(portal, search_sub=True, apply_func=indexObject)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 398 of file CatalogTool.py.

00398 
00399     def getCounter(self):
00400         return self._counter is not None and self._counter() or 0

def CMFPlone.CatalogTool.CatalogTool.indexObject (   self,
  object,
  idxs = [] 
)
Add object to catalog.

The optional idxs argument is a list of specific indexes
to populate (all of them by default).

Definition at line 356 of file CatalogTool.py.

00356 
00357     def indexObject(self, object, idxs=[]):
00358         """Add object to catalog.
00359 
00360         The optional idxs argument is a list of specific indexes
00361         to populate (all of them by default).
00362         """
00363         self.reindexObject(object, idxs)

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFPlone.CatalogTool.CatalogTool.manage_catalogRebuild (   self,
  RESPONSE = None,
  URL1 = None 
)
Clears the catalog and indexes all objects with an 'indexObject' method.
   This may take a long time.

Definition at line 445 of file CatalogTool.py.

00445 
00446     def manage_catalogRebuild(self, RESPONSE=None, URL1=None):
00447         """Clears the catalog and indexes all objects with an 'indexObject' method.
00448            This may take a long time.
00449         """
00450         elapse = time.time()
00451         c_elapse = time.clock()
00452 
00453         self.clearFindAndRebuild()
00454 
00455         elapse = time.time() - elapse
00456         c_elapse = time.clock() - c_elapse
00457 
00458         if RESPONSE is not None:
00459             RESPONSE.redirect(
00460               URL1 + '/manage_catalogAdvanced?manage_tabs_message=' +
00461               urllib.quote('Catalog Rebuilt\n'
00462                            'Total time: %s\n'
00463                            'Total CPU time: %s' % (`elapse`, `c_elapse`)))
00464 
00465 CatalogTool.__doc__ = BaseTool.__doc__
00466 
00467 InitializeClass(CatalogTool)

Here is the call graph for this function:

def CMFPlone.CatalogTool.CatalogTool.searchResults (   self,
  REQUEST = None,
  kw 
)
Calls ZCatalog.searchResults with extra arguments that
limit the results to what the user is allowed to see.

This version uses the 'effectiveRange' DateRangeIndex.

It also accepts a keyword argument show_inactive to disable
effectiveRange checking entirely even for those without portal
wide AccessInactivePortalContent permission.

Definition at line 402 of file CatalogTool.py.

00402 
00403     def searchResults(self, REQUEST=None, **kw):
00404         """Calls ZCatalog.searchResults with extra arguments that
00405         limit the results to what the user is allowed to see.
00406 
00407         This version uses the 'effectiveRange' DateRangeIndex.
00408 
00409         It also accepts a keyword argument show_inactive to disable
00410         effectiveRange checking entirely even for those without portal
00411         wide AccessInactivePortalContent permission.
00412         """
00413         kw = kw.copy()
00414         show_inactive = kw.get('show_inactive', False)
00415 
00416         user = _getAuthenticatedUser(self)
00417         kw['allowedRolesAndUsers'] = self._listAllowedRolesAndUsers(user)
00418 
00419         if not show_inactive and not _checkPermission(AccessInactivePortalContent, self):
00420             kw['effectiveRange'] = DateTime()
00421 
00422         return ZCatalog.searchResults(self, REQUEST, **kw)

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFPlone.CatalogTool.CatalogTool.uncatalog_object (   self,
  args,
  kwargs 
)

Definition at line 388 of file CatalogTool.py.

00388 
00389     def uncatalog_object(self, *args, **kwargs):
00390         self._increment_counter()
00391         return BaseTool.uncatalog_object(self, *args, **kwargs)

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 423 of file CatalogTool.py.

tuple CMFPlone.CatalogTool.CatalogTool.__implements__ = (PloneBaseTool.__implements__, BaseTool.__implements__) [static, private]

Definition at line 332 of file CatalogTool.py.

Definition at line 328 of file CatalogTool.py.

tuple CMFPlone.CatalogTool.CatalogTool.manage_catalogAdvanced = DTMLFile('www/catalogAdvanced', globals()) [static]

Definition at line 330 of file CatalogTool.py.

Definition at line 325 of file CatalogTool.py.

tuple CMFPlone.CatalogTool.CatalogTool.security = ClassSecurityInfo() [static]

Definition at line 326 of file CatalogTool.py.

string CMFPlone.CatalogTool.CatalogTool.toolicon = 'skins/plone_images/book_icon.gif' [static]

Definition at line 327 of file CatalogTool.py.


The documentation for this class was generated from the following file: