# HG changeset patch # User Sylvain Thénault # Date 1250859020 -7200 # Node ID 48507919b6e36ab43586cacc5325f7ecaa214903 # Parent d0b77dd2774074c1a35dab2d3bc0aeda49d0f101 [wf] oops, BaseTransition.__init__ may be called for subclasses diff -r d0b77dd27740 -r 48507919b6e3 entities/test/unittest_wfobjs.py --- a/entities/test/unittest_wfobjs.py Fri Aug 21 09:03:30 2009 +0200 +++ b/entities/test/unittest_wfobjs.py Fri Aug 21 14:50:20 2009 +0200 @@ -198,6 +198,7 @@ self.assertEquals(len(transitions), 1) self.assertEquals(transitions[0].name, 'tr1') + class CustomWorkflowTC(EnvBasedTC): def setup_database(self): diff -r d0b77dd27740 -r 48507919b6e3 entities/wfobjs.py --- a/entities/wfobjs.py Fri Aug 21 09:03:30 2009 +0200 +++ b/entities/wfobjs.py Fri Aug 21 14:50:20 2009 +0200 @@ -124,7 +124,9 @@ fetch_attrs, fetch_order = fetch_config(['name']) def __init__(self, *args, **kwargs): - raise Exception('should not be instantiated') + if self.id == 'BaseTransition': + raise Exception('should not be instantiated') + super(BaseTransition, self).__init__(*args, **kwargs) def may_be_fired(self, eid): """return true if the logged user may fire this transition