On 23/05/13 14:54 +0000, [email protected] wrote: > Reviewers: , > > Description: > trytond: Fix Pool.setup to re-allow extra_depends behavior > > Please review this at http://codereview.tryton.org/898002/ > > Affected files: > M trytond/pool.py > > > Index: trytond/pool.py > =================================================================== > --- a/trytond/pool.py > +++ b/trytond/pool.py > @@ -62,6 +62,7 @@ > for cls in classes: > mpool = Pool.classes[type_].setdefault(module, []) > assert cls not in mpool, cls > + assert issubclass(cls.__class__, PoolMeta) > mpool.append(cls) > > @classmethod > @@ -194,6 +195,9 @@ > Setup classes for module and return a list of classes for > each type in > a dictionary. > ''' > + from trytond.model import Model > + from trytond.wizard import Wizard > + from trytond.report import Report > classes = {} > for type_ in self.classes.keys(): > classes[type_] = [] > @@ -203,11 +207,9 @@ > cls = type(cls.__name__, (cls, previous_cls), {}) > except KeyError: > pass > - if (not hasattr(cls, '__setup__') > - and issubclass(cls.__class__, PoolMeta)): > + if not issubclass(cls, (Model, Wizard, Report)): > continue > - else: > - cls.__setup__() > + cls.__setup__() > self.add(cls, type=type_) > classes[type_].append(cls) > for cls in classes[type_]: > >
I'm not very happy to have to import Model, Wizard and Report in Pool. If anyone has a better idea, you are welcome. -- Cédric Krier B2CK SPRL Rue de Rotterdam, 4 4000 Liège Belgium Tel: +32 472 54 46 59 Email/Jabber: [email protected] Website: http://www.b2ck.com/
pgpwSiD5fM2IS.pgp
Description: PGP signature
