[Zope-Checkins] SVN: Zope/trunk/src/OFS/Traversable.py micro optimization

Nikolay Kim fafhrd91 at gmail.com
Mon Jul 18 14:44:15 EDT 2011


Log message for revision 122281:
  micro optimization

Changed:
  U   Zope/trunk/src/OFS/Traversable.py

-=-
Modified: Zope/trunk/src/OFS/Traversable.py
===================================================================
--- Zope/trunk/src/OFS/Traversable.py	2011-07-18 18:42:54 UTC (rev 122280)
+++ Zope/trunk/src/OFS/Traversable.py	2011-07-18 18:44:15 UTC (rev 122281)
@@ -119,12 +119,9 @@
         calls while walking up from an object on a deep level.
         """
         try:
-            id = self.id
+            id = self.id or self.getId()
         except AttributeError:
             id = self.getId()
-        else:
-            if id is None:
-                id = self.getId()
 
         path = (id, )
         p = aq_parent(aq_inner(self))
@@ -135,12 +132,9 @@
         while p is not None:
             if func is p.getPhysicalPath.im_func:
                 try:
-                    pid = p.id
+                    pid = p.id or p.getId()
                 except AttributeError:
                     pid = p.getId()
-                else:
-                    if pid is None:
-                        pid = p.getId()
 
                 path = (pid, ) + path
                 try:



More information about the Zope-Checkins mailing list