Back to index

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

List of all members.

Public Member Functions

def resolve_url
def catalog_object

Static Public Attributes

tuple security = ClassSecurityInfo()

Private Attributes

 _v_portal_path_len

Detailed Description

Definition at line 138 of file UIDCatalog.py.


Member Function Documentation

def Archetypes.UIDCatalog.UIDResolver.catalog_object (   self,
  obj,
  uid = None,
  kwargs 
)
Use the relative path from the portal root as uid

Ordinary the catalog is using the path from root towards object but we
want only a relative path from the portal root

Note: This method could be optimized by improving the calculation of the
      relative path like storing the portal root physical path in a
      _v_ var.

Definition at line 155 of file UIDCatalog.py.

00155 
00156     def catalog_object(self, obj, uid=None, **kwargs):
00157         """Use the relative path from the portal root as uid
00158 
00159         Ordinary the catalog is using the path from root towards object but we
00160         want only a relative path from the portal root
00161 
00162         Note: This method could be optimized by improving the calculation of the
00163               relative path like storing the portal root physical path in a
00164               _v_ var.
00165         """
00166         portal_path_len = getattr(aq_base(self), '_v_portal_path_len', None)
00167 
00168         if not portal_path_len:
00169             # cache the lenght of the portal path in a _v_ var
00170             urlTool = getToolByName(self, 'portal_url')
00171             portal_path = urlTool.getPortalObject().getPhysicalPath()
00172             portal_path_len = len(portal_path)
00173             self._v_portal_path_len = portal_path_len
00174 
00175         relpath = obj.getPhysicalPath()[portal_path_len:]
00176         uid = '/'.join(relpath)
00177         __traceback_info__ = (repr(obj), uid)
00178         ZCatalog.catalog_object(self, obj, uid, **kwargs)
00179 
00180 InitializeClass(UIDResolver)

Here is the call graph for this function:

Here is the caller graph for this function:

def Archetypes.UIDCatalog.UIDResolver.resolve_url (   self,
  path,
  REQUEST 
)
Strip path prefix during resolution, This interacts with
the default brains.getObject model and allows and fakes the
ZCatalog protocol for traversal

Definition at line 143 of file UIDCatalog.py.

00143 
00144     def resolve_url(self, path, REQUEST):
00145         """Strip path prefix during resolution, This interacts with
00146         the default brains.getObject model and allows and fakes the
00147         ZCatalog protocol for traversal
00148         """
00149         portal_object = self.portal_url.getPortalObject()
00150         try:
00151             return portal_object.unrestrictedTraverse(path)
00152         except (KeyError, AttributeError, NotFound):
00153             # ObjectManager may raise a KeyError when the object isn't there
00154             return None


Member Data Documentation

Definition at line 172 of file UIDCatalog.py.

tuple Archetypes.UIDCatalog.UIDResolver.security = ClassSecurityInfo() [static]

Reimplemented in Archetypes.UIDCatalog.UIDCatalog.

Definition at line 140 of file UIDCatalog.py.


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