Back to index

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

List of all members.

Public Member Functions

def __init__
def catalog_object
def manage_rebuildCatalog
def resolve_url
def catalog_object

Static Public Attributes

 id = UID_CATALOG
tuple security = ClassSecurityInfo()
tuple manage_catalogFind = DTMLFile('catalogFind', _catalog_dtml)
 manage_options = ZCatalog.manage_options+\

Private Member Functions

def _catalogObject

Private Attributes

 _catalog

Detailed Description

Unique id catalog

Definition at line 185 of file UIDCatalog.py.


Constructor & Destructor Documentation

def Archetypes.UIDCatalog.UIDCatalog.__init__ (   self,
  id,
  title = '',
  vocab_id = None,
  container = None 
)
We hook up the brains now

Definition at line 200 of file UIDCatalog.py.

00200 
00201     def __init__(self, id, title='', vocab_id=None, container=None):
00202         """We hook up the brains now"""
00203         ZCatalog.__init__(self, id, title, vocab_id, container)
00204         self._catalog = UIDBaseCatalog()


Member Function Documentation

def Archetypes.UIDCatalog.UIDCatalog._catalogObject (   self,
  obj,
  path 
) [private]
Catalog the object. The object will be cataloged with the absolute
   path in case we don't pass the relative url.

Definition at line 221 of file UIDCatalog.py.

00221 
00222     def _catalogObject(self, obj, path):
00223         """Catalog the object. The object will be cataloged with the absolute
00224            path in case we don't pass the relative url.
00225         """ 
00226         url = getRelURL(self, obj.getPhysicalPath()) 
00227         self.catalog_object(obj, url) 

Here is the call graph for this function:

Here is the caller graph for this function:

def Archetypes.UIDCatalog.UIDResolver.catalog_object (   self,
  obj,
  uid = None,
  kwargs 
) [inherited]
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.UIDCatalog.catalog_object (   self,
  object,
  uid,
  idxs = [],
  update_metadata = 1,
  pghandler = None 
)

Definition at line 207 of file UIDCatalog.py.

00207 
00208                        update_metadata=1, pghandler=None):
00209         w = IndexableObjectWrapper(object)
00210         try:
00211             # pghandler argument got added in Zope 2.8
00212             ZCatalog.catalog_object(self, w, uid, idxs,
00213                                     update_metadata, pghandler=pghandler)
00214         except TypeError:
00215             try:
00216                 # update_metadata argument got added somewhere into
00217                 # the Zope 2.6 line (?)
00218                 ZCatalog.catalog_object(self, w, uid, idxs, update_metadata)
00219             except TypeError:
00220                 ZCatalog.catalog_object(self, w, uid, idxs)

Here is the caller graph for this function:

def Archetypes.UIDCatalog.UIDCatalog.manage_rebuildCatalog (   self,
  REQUEST = None,
  RESPONSE = None 
)

Definition at line 229 of file UIDCatalog.py.

00229 
00230     def manage_rebuildCatalog(self, REQUEST=None, RESPONSE=None):
00231         """
00232         """
00233         elapse = time.time()
00234         c_elapse = time.clock()
00235 
00236         atool   = getToolByName(self, TOOL_NAME)
00237         obj     = aq_parent(self)
00238         path    = '/'.join(obj.getPhysicalPath())
00239         if not REQUEST:
00240             REQUEST = self.REQUEST
00241 
00242         # build a list of archetype meta types
00243         mt = tuple([typ['meta_type'] for typ in atool.listRegisteredTypes()])
00244 
00245         # clear the catalog
00246         self.manage_catalogClear()
00247 
00248         # find and catalog objects
00249         self.ZopeFindAndApply(obj,
00250                               obj_metatypes=mt,
00251                               search_sub=1,
00252                               REQUEST=REQUEST,
00253                               apply_func=self._catalogObject,
00254                               apply_path=path)
00255 
00256         elapse = time.time() - elapse
00257         c_elapse = time.clock() - c_elapse
00258 
00259         if RESPONSE:
00260             RESPONSE.redirect(
00261             REQUEST.URL1 +
00262             '/manage_catalogView?manage_tabs_message=' +
00263             urllib.quote('Catalog Rebuilded\n'
00264                          'Total time: %s\n'
00265                          'Total CPU time: %s'
00266                          % (`elapse`, `c_elapse`))
00267             )
00268 
00269 InitializeClass(UIDCatalog)

Here is the call graph for this function:

def Archetypes.UIDCatalog.UIDResolver.resolve_url (   self,
  path,
  REQUEST 
) [inherited]
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 203 of file UIDCatalog.py.

Archetypes.UIDCatalog.UIDCatalog.id = UID_CATALOG [static]

Definition at line 189 of file UIDCatalog.py.

tuple Archetypes.UIDCatalog.UIDCatalog.manage_catalogFind = DTMLFile('catalogFind', _catalog_dtml) [static]

Definition at line 193 of file UIDCatalog.py.

Archetypes.UIDCatalog.UIDCatalog.manage_options = ZCatalog.manage_options+\ [static]

Definition at line 195 of file UIDCatalog.py.

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

Reimplemented from Archetypes.UIDCatalog.UIDResolver.

Definition at line 190 of file UIDCatalog.py.


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