Back to index

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

List of all members.

Public Member Functions

def getCatalogs
def indexObject
def unindexObject
def reindexObjectSecurity
def reindexObject

Static Public Attributes

tuple security = ClassSecurityInfo()

Private Member Functions

def __url

Detailed Description

Definition at line 14 of file CatalogMultiplex.py.


Member Function Documentation

Definition at line 17 of file CatalogMultiplex.py.

00017 
00018     def __url(self):
00019         return '/'.join( self.getPhysicalPath() )

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 20 of file CatalogMultiplex.py.

00020 
00021     def getCatalogs(self):
00022         at = getToolByName(self, TOOL_NAME, None)
00023         if at is None:
00024             return []
00025 
00026         if CATALOGMAP_USES_PORTALTYPE:
00027             return at.getCatalogsByType(self.portal_type)
00028         else:
00029             return at.getCatalogsByType(self.meta_type)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 31 of file CatalogMultiplex.py.

00031 
00032     def indexObject(self):
00033         catalogs = self.getCatalogs()
00034         url = self.__url()
00035         for c in catalogs:
00036             c.catalog_object(self, url)

Here is the call graph for this function:

update indexes of this object in all registered catalogs.

Catalogs are registered per 'meta_type' in archetypes tool.

'idxs' are a list of index names. If this list is given only the given
indexes are refreshed. If a index does not exist in catalog its
silently ignored.

Definition at line 84 of file CatalogMultiplex.py.

00084 
00085     def reindexObject(self, idxs=[]):
00086         """update indexes of this object in all registered catalogs.
00087 
00088         Catalogs are registered per 'meta_type' in archetypes tool.
00089 
00090         'idxs' are a list of index names. If this list is given only the given
00091         indexes are refreshed. If a index does not exist in catalog its
00092         silently ignored.
00093         """
00094         if idxs == [] and shasattr(self, 'notifyModified'):
00095             # Archetypes default setup has this defined in ExtensibleMetadata
00096             # mixin. note: this refreshes the 'etag ' too.
00097             self.notifyModified()
00098 
00099         self.http__refreshEtag()
00100 
00101         catalogs = self.getCatalogs()
00102         if not catalogs:
00103             return
00104 
00105         url = self.__url()
00106 
00107         for c in catalogs:
00108             if c is not None:
00109                 # We want the intersection of the catalogs idxs
00110                 # and the incoming list.
00111                 lst = idxs
00112                 indexes = c.indexes()
00113                 if idxs:
00114                     lst = [i for i in idxs if i in indexes]
00115                 c.catalog_object(self, url, idxs=lst)
00116 
00117         # We only make this call if idxs is not passed.
00118         #
00119         # manage_afterAdd/manage_beforeDelete from Referenceable take
00120         # care of most of the issues, but some places still expect to
00121         # call reindexObject and have the uid_catalog updated.
00122         # TODO: fix this so we can remove the following lines.
00123         if not idxs:
00124             if isinstance(self, Referenceable):
00125                 isCopy = getattr(self, '_v_is_cp', None)
00126                 if isCopy is None:
00127                     self._catalogUID(self)
00128 
00129 InitializeClass(CatalogMultiplex)

Here is the call graph for this function:

Here is the caller graph for this function:

update security information in all registered catalogs.

Definition at line 46 of file CatalogMultiplex.py.

00046 
00047     def reindexObjectSecurity(self, skip_self=False):
00048         """update security information in all registered catalogs.
00049         """
00050         at = getToolByName(self, TOOL_NAME, None)
00051         if at is None:
00052             return
00053 
00054         catalogs = [c for c in at.getCatalogsByType(self.meta_type)
00055                                 if c is not None]
00056         path = '/'.join(self.getPhysicalPath())
00057 
00058         for catalog in catalogs:
00059             for brain in catalog.unrestrictedSearchResults(path=path):
00060                 brain_path = brain.getPath()
00061                 if brain_path == path and skip_self:
00062                     continue
00063 
00064                 # Get the object
00065                 if hasattr(aq_base(brain), '_unrestrictedGetObject'):
00066                     ob = brain._unrestrictedGetObject()
00067                 else:
00068                     # BBB: Zope 2.7
00069                     ob = self.unrestrictedTraverse(brain_path, None)
00070                 if ob is None:
00071                     # BBB: Ignore old references to deleted objects.
00072                     # Can happen only in Zope 2.7, or when using
00073                     # catalog-getObject-raises off in Zope 2.8
00074                     log("reindexObjectSecurity: Cannot get %s from catalog" % 
00075                         brain_path, level=WARNING)
00076                     continue
00077 
00078                 # Recatalog with the same catalog uid.
00079                 catalog.reindexObject(ob, idxs=self._cmf_security_indexes,
00080                                         update_metadata=0, uid=brain_path)
00081 
00082 

Here is the call graph for this function:

Definition at line 38 of file CatalogMultiplex.py.

00038 
00039     def unindexObject(self):
00040         catalogs = self.getCatalogs()
00041         url = self.__url()
00042         for c in catalogs:
00043             if c._catalog.uids.get(url, None) is not None:
00044                 c.uncatalog_object(url)

Here is the call graph for this function:


Member Data Documentation

tuple Archetypes.CatalogMultiplex.CatalogMultiplex.security = ClassSecurityInfo() [static]

Definition at line 15 of file CatalogMultiplex.py.


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