Skip to content

Instantly share code, notes, and snippets.

@zopyx
Created March 28, 2014 08:48
Show Gist options
  • Save zopyx/9828198 to your computer and use it in GitHub Desktop.
Save zopyx/9828198 to your computer and use it in GitHub Desktop.
def linked_object_obj(self, obj):
print obj
try:
o = obj.getObject()
except Exception:
o = None
return o
try:
object_path = obj.getObject().getPhysicalPath()
except AttributeError:
object_path = '/'
if object_path is None or len(object_path)==0:
return None
if object_path[0]=='/':
object_path = object_path[1:]
return self.portal.restrictedTraverse(object_path, default=None)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment