[Erp5-report] r19649 - /erp5/trunk/products/ERP5Type/Base.py

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Mar 3 14:05:53 CET 2008


Author: kazuhiko
Date: Mon Mar  3 14:05:52 2008
New Revision: 19649

URL: http://svn.erp5.org?rev=19649&view=rev
Log:
* this implementation of getPortalObject() seems a little bit faster than previous one with cache.
* getRootDocumentPath() returns itself instead of None if no root domument.

Modified:
    erp5/trunk/products/ERP5Type/Base.py

Modified: erp5/trunk/products/ERP5Type/Base.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Base.py?rev=19649&r1=19648&r2=19649&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Base.py (original)
+++ erp5/trunk/products/ERP5Type/Base.py Mon Mar  3 14:05:52 2008
@@ -1759,20 +1759,7 @@
     """
       Returns the portal object
     """
-    cache = getReadOnlyTransactionCache(self)
-    if cache is not None:
-      key = 'getPortalObject'
-      try:
-        return cache[key]
-      except KeyError:
-        pass
-
-    result = self.portal_url.getPortalObject()
-
-    if cache is not None:
-      cache[key] = result
-
-    return result
+    return self.aq_inner.aq_parent.getPortalObject()
 
   security.declareProtected(Permissions.AccessContentsInformation, 'getWorkflowIds')
   def getWorkflowIds(self):
@@ -2708,15 +2695,10 @@
   recursiveReindexObject = reindexObject
 
   def getRootDocumentPath(self):
-    # if document, return the path of its root document
-    # otherwire, return None
+    # Return the path of its root document, or itself if no root document.
     self_path_list = self.getPhysicalPath()
-    self_depth = len(self_path_list)
     portal_depth = len(self.getPortalObject().getPhysicalPath())
-    if self_depth > portal_depth + 1:
-      return '/'.join(self_path_list[:portal_depth + 2])
-    else:
-      return None
+    return '/'.join(self_path_list[:portal_depth+2])
 
   security.declareProtected( Permissions.AccessContentsInformation, 'getIndexableChildValueList' )
   def getIndexableChildValueList(self):




More information about the Erp5-report mailing list