Back to index

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

List of all members.

Public Member Functions

def indexObject
def unindexObject
def reindexObject
def reindexObjectSecurity
def notifyWorkflowCreated
def opaqueItems
def opaqueIds
def opaqueValues
def manage_workflowsTab

Static Public Attributes

tuple security = ClassSecurityInfo()
tuple manage_options

Private Member Functions

def _getCatalogTool
def _getWorkflowTool

Static Private Attributes

tuple _cmf_security_indexes = ('allowedRolesAndUsers',)
tuple _manage_workflowsTab = DTMLFile('zmi_workflows', _dtmldir)

Detailed Description

Mix-in for notifying portal_catalog and portal_workflow

Definition at line 44 of file CMFCatalogAware.py.


Member Function Documentation

Definition at line 55 of file CMFCatalogAware.py.

00055 
00056     def _getCatalogTool(self):
00057         return getToolByName(self, 'portal_catalog', None)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 58 of file CMFCatalogAware.py.

00058 
00059     def _getWorkflowTool(self):
00060         return getToolByName(self, 'portal_workflow', None)

Here is the call graph for this function:

Here is the caller graph for this function:

    Index the object in the portal catalog.

Definition at line 65 of file CMFCatalogAware.py.

00065 
00066     def indexObject(self):
00067         """
00068             Index the object in the portal catalog.
00069         """
00070         catalog = self._getCatalogTool()
00071         if catalog is not None:
00072             catalog.indexObject(self)

Here is the call graph for this function:

def CMFCore.CMFCatalogAware.CMFCatalogAware.manage_workflowsTab (   self,
  REQUEST,
  manage_tabs_message = None 
)
    Tab displaying the current workflows for the content object.

Definition at line 209 of file CMFCatalogAware.py.

00209 
00210     def manage_workflowsTab(self, REQUEST, manage_tabs_message=None):
00211         """
00212             Tab displaying the current workflows for the content object.
00213         """
00214         ob = self
00215         wftool = self._getWorkflowTool()
00216         # XXX None ?
00217         if wftool is not None:
00218             wf_ids = wftool.getChainFor(ob)
00219             states = {}
00220             chain = []
00221             for wf_id in wf_ids:
00222                 wf = wftool.getWorkflowById(wf_id)
00223                 if wf is not None:
00224                     # XXX a standard API would be nice
00225                     if hasattr(wf, 'getReviewStateOf'):
00226                         # Default Workflow
00227                         state = wf.getReviewStateOf(ob)
00228                     elif hasattr(wf, '_getWorkflowStateOf'):
00229                         # DCWorkflow
00230                         state = wf._getWorkflowStateOf(ob, id_only=1)
00231                     else:
00232                         state = '(Unknown)'
00233                     states[wf_id] = state
00234                     chain.append(wf_id)
00235         return self._manage_workflowsTab(
00236             REQUEST,
00237             chain=chain,
00238             states=states,
00239             management_view='Workflows',
00240             manage_tabs_message=manage_tabs_message)
00241 
00242 InitializeClass(CMFCatalogAware)
00243 

Here is the call graph for this function:

    Notify the workflow that self was just created.

Definition at line 142 of file CMFCatalogAware.py.

00142 
00143     def notifyWorkflowCreated(self):
00144         """
00145             Notify the workflow that self was just created.
00146         """
00147         wftool = self._getWorkflowTool()
00148         if wftool is not None:
00149             wftool.notifyCreated(self)

Here is the call graph for this function:

    Return opaque ids (subelements that are contained
    using something that is not an ObjectManager).

Definition at line 183 of file CMFCatalogAware.py.

00183 
00184     def opaqueIds(self):
00185         """
00186             Return opaque ids (subelements that are contained
00187             using something that is not an ObjectManager).
00188         """
00189         return [t[0] for t in self.opaqueItems()]

Here is the call graph for this function:

    Return opaque items (subelements that are contained
    using something that is not an ObjectManager).

Definition at line 154 of file CMFCatalogAware.py.

00154 
00155     def opaqueItems(self):
00156         """
00157             Return opaque items (subelements that are contained
00158             using something that is not an ObjectManager).
00159         """
00160         items = []
00161 
00162         # Call 'talkback' knowing that it is an opaque item.
00163         # This will remain here as long as the discussion item does
00164         # not implement ICallableOpaqueItem (backwards compatibility).
00165         if hasattr(aq_base(self), 'talkback'):
00166             talkback = self.talkback
00167             if talkback is not None:
00168                 items.append((talkback.id, talkback))
00169 
00170         # Other opaque items than 'talkback' may have callable
00171         # manage_after* and manage_before* hooks.
00172         # Loop over all attributes and add those to 'items'
00173         # implementing 'ICallableOpaqueItem'.
00174         self_base = aq_base(self)
00175         for name in self_base.__dict__.keys():
00176             obj = getattr(self, name)
00177             if ICallableOpaqueItem.providedBy(obj) \
00178                     or z2ICallableOpaqueItem.isImplementedBy(obj):
00179                 items.append((obj.getId(), obj))
00180 
00181         return tuple(items)

Here is the caller graph for this function:

    Return opaque values (subelements that are contained
    using something that is not an ObjectManager).

Definition at line 191 of file CMFCatalogAware.py.

00191 
00192     def opaqueValues(self):
00193         """
00194             Return opaque values (subelements that are contained
00195             using something that is not an ObjectManager).
00196         """
00197         return [t[1] for t in self.opaqueItems()]

Here is the call graph for this function:

    Reindex the object in the portal catalog.
    If idxs is present, only those indexes are reindexed.
    The metadata is always updated.

    Also update the modification date of the object,
    unless specific indexes were requested.

Definition at line 83 of file CMFCatalogAware.py.

00083 
00084     def reindexObject(self, idxs=[]):
00085         """
00086             Reindex the object in the portal catalog.
00087             If idxs is present, only those indexes are reindexed.
00088             The metadata is always updated.
00089 
00090             Also update the modification date of the object,
00091             unless specific indexes were requested.
00092         """
00093         if idxs == []:
00094             # Update the modification date.
00095             if hasattr(aq_base(self), 'notifyModified'):
00096                 self.notifyModified()
00097         catalog = self._getCatalogTool()
00098         if catalog is not None:
00099             catalog.reindexObject(self, idxs=idxs)

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFCore.CMFCatalogAware.CMFCatalogAware.reindexObjectSecurity (   self,
  skip_self = False 
)
Reindex security-related indexes on the object.

Recurses in the children to reindex them too.

If skip_self is True, only the children will be reindexed. This
is a useful optimization if the object itself has just been
fully reindexed, as there's no need to reindex its security twice.

Definition at line 103 of file CMFCatalogAware.py.

00103 
00104     def reindexObjectSecurity(self, skip_self=False):
00105         """Reindex security-related indexes on the object.
00106 
00107         Recurses in the children to reindex them too.
00108 
00109         If skip_self is True, only the children will be reindexed. This
00110         is a useful optimization if the object itself has just been
00111         fully reindexed, as there's no need to reindex its security twice.
00112         """
00113         catalog = self._getCatalogTool()
00114         if catalog is None:
00115             return
00116         path = '/'.join(self.getPhysicalPath())
00117 
00118         # XXX if _getCatalogTool() is overriden we will have to change
00119         # this method for the sub-objects.
00120         for brain in catalog.unrestrictedSearchResults(path=path):
00121             brain_path = brain.getPath()
00122             if brain_path == path and skip_self:
00123                 continue
00124             # Get the object
00125             ob = brain._unrestrictedGetObject()
00126             if ob is None:
00127                 # BBB: Ignore old references to deleted objects.
00128                 # Can happen only when using
00129                 # catalog-getObject-raises off in Zope 2.8
00130                 logger.warning("reindexObjectSecurity: Cannot get %s from "
00131                                "catalog", brain_path)
00132                 continue
00133             # Recatalog with the same catalog uid.
00134             s = getattr(ob, '_p_changed', 0)
00135             catalog.reindexObject(ob, idxs=self._cmf_security_indexes,
00136                                   update_metadata=0, uid=brain_path)
00137             if s is None: ob._p_deactivate()

Here is the call graph for this function:

    Unindex the object from the portal catalog.

Definition at line 74 of file CMFCatalogAware.py.

00074 
00075     def unindexObject(self):
00076         """
00077             Unindex the object from the portal catalog.
00078         """
00079         catalog = self._getCatalogTool()
00080         if catalog is not None:
00081             catalog.unindexObject(self)

Here is the call graph for this function:


Member Data Documentation

tuple CMFCore.CMFCatalogAware.CMFCatalogAware._cmf_security_indexes = ('allowedRolesAndUsers',) [static, private]

Definition at line 100 of file CMFCatalogAware.py.

tuple CMFCore.CMFCatalogAware.CMFCatalogAware._manage_workflowsTab = DTMLFile('zmi_workflows', _dtmldir) [static, private]

Definition at line 206 of file CMFCatalogAware.py.

Initial value:
({'label': 'Workflows',
                       'action': 'manage_workflowsTab',
                       },
                       )

Definition at line 201 of file CMFCatalogAware.py.

tuple CMFCore.CMFCatalogAware.CMFCatalogAware.security = ClassSecurityInfo() [static]

Definition at line 49 of file CMFCatalogAware.py.


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