PATCH: trytond: model.__setup__: don't hide AttributeError which could occur (issue 895002)

3 views
Skip to first unread message

coinl...@gmail.com

unread,
May 22, 2013, 2:24:42 PM5/22/13
to coinl...@gmail.com, re...@tryton-rietveld-hrd.appspotmail.com, tryto...@googlegroups.com
Reviewers: ,



Please review this at http://codereview.tryton.org/895002/

Affected files:
M trytond/pool.py


Index: trytond/pool.py
===================================================================
--- a/trytond/pool.py
+++ b/trytond/pool.py
@@ -203,12 +203,13 @@
cls = type(cls.__name__, (cls, previous_cls), {})
except KeyError:
pass
- try:
+ if hasattr(cls, '__setup__'):
cls.__setup__()
- except AttributeError:
- if issubclass(cls.__class__, PoolMeta):
- continue
- raise
+ elif issubclass(cls.__class__, PoolMeta):
+ continue
+ else:
+ raise AttributeError("'%s' has no method '__setup__'" %
+ cls.__name__)
self.add(cls, type=type_)
classes[type_].append(cls)
for cls in classes[type_]:


Reply all
Reply to author
Forward
0 new messages