Commit 8060223e authored by Nikolay Kim's avatar Nikolay Kim

micro optimization

parent bc6bb33f
...@@ -119,12 +119,9 @@ class Traversable: ...@@ -119,12 +119,9 @@ class Traversable:
calls while walking up from an object on a deep level. calls while walking up from an object on a deep level.
""" """
try: try:
id = self.id id = self.id or self.getId()
except AttributeError: except AttributeError:
id = self.getId() id = self.getId()
else:
if id is None:
id = self.getId()
path = (id, ) path = (id, )
p = aq_parent(aq_inner(self)) p = aq_parent(aq_inner(self))
...@@ -135,12 +132,9 @@ class Traversable: ...@@ -135,12 +132,9 @@ class Traversable:
while p is not None: while p is not None:
if func is p.getPhysicalPath.im_func: if func is p.getPhysicalPath.im_func:
try: try:
pid = p.id pid = p.id or p.getId()
except AttributeError: except AttributeError:
pid = p.getId() pid = p.getId()
else:
if pid is None:
pid = p.getId()
path = (pid, ) + path path = (pid, ) + path
try: try:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment