Commit 1c9ce872 authored by Vincent Pelletier's avatar Vincent Pelletier

Use getattr instead of hasattr.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14132 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a803f006
......@@ -861,7 +861,7 @@ class Subscription(Folder, SyncCode):
LOG('getGidFromObject gid_generator',0,'is callable')
o_gid=gid_gen(object)
LOG('getGidFromObject',0,'o_gid: %s' % repr(o_gid))
elif hasattr(o_base, gid_gen):
elif getattr(o_base, gid_gen, None) is not None:
LOG('getGidFromObject',0,'there is the gid generator on o_base')
generator = getattr(object, gid_gen)
o_gid = generator()
......@@ -945,7 +945,7 @@ class Subscription(Folder, SyncCode):
new_id = None
if callable(id_generator):
new_id = id_generator(object,gid=gid)
elif hasattr(o_base, id_generator):
elif getattr(o_base, id_generator, None) is not None:
generator = getattr(object, id_generator)
new_id = generator()
else:
......
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