Permalink
Browse files

simplify oid_of impl

  • Loading branch information...
1 parent dc17e71 commit 2f39355e085dc79be3b7436c9e3b5d99019584f4 @mcdonc mcdonc committed Apr 10, 2012
Showing with 4 additions and 4 deletions.
  1. +4 −4 substanced/util/__init__.py
@@ -24,10 +24,10 @@ def visit(node):
return visit(startnode)
def oid_of(obj, default=_marker):
- oid = getattr(obj, '__objectid__', default)
- if oid is _marker:
+ try:
+ return obj.__objectid__
+ except AttributeError:
if default is _marker:
- raise KeyError('%s has no __objectid__' % (obj,))
+ raise
return default
- return oid

0 comments on commit 2f39355

Please sign in to comment.