[PEAK] gf.when() doesn't honour Interfaces on instances
(protocols.adviseObject)
Ulrich Eck
ueck at net-labs.de
Thu Dec 2 10:38:14 EST 2004
Hi Radek,
thanks for your immediate suggestion .. but it seems that i've still hit
an issue .. using "in" in the when-clauses doesn't change the behaviour
and is still not what i'ld expect (from a pythonic pov) ..
cheers
Ulrich
Am Donnerstag, den 02.12.2004, 15:57 +0100 schrieb Radek Kanovsky:
> On Thu, Dec 02, 2004 at 03:35:46PM +0100, Ulrich Eck wrote:
>
> > [callMethod.when("self is IPPStatePrivate and > event.name=='submit'")]
> > def callMethod_submit(self, event):
> > print "Submit", event
> > protocols.adviseObject(self,provides=[IPPStatePending],
> > doesNotProvide=[IPPStatePrivate])
> >
> > [callMethod.when("self is IPPStatePending and > event.name=='publish'")]
> > def callMethod_publish(self, event):
> > print "Publish", event
> > protocols.adviseObject(self,provides=[IPPStatePublished],
> > doesNotProvide=[IPPStatePending])
> >
> > [callMethod.when("self is IPPStatePublished and > event.name=='retract'")]
> > def callMethod_retract(self, event):
> > print "Retract", event
> > protocols.adviseObject(self,provides=[IPPStatePrivate],
> > doesNotProvide=[IPPStatePublished])
>
> Hi,
>
> I think, that you should replace ``is'' by ``in'' in all predicates.
>
> "self in IPPStatePublished and > event.name=='retract'"
>
> > Traceback (most recent call last):
> > File "<stdin>", line 1, in ?
> > File "<string>", line 5, in callMethod
> > File "/usr/lib/python2.3/site-packages/dispatch/functions.py", line
> > 319, in __getitem__
> > raise NoApplicableMethods
> > dispatch.interfaces.NoApplicableMethods
>
> I have a small suggestion. It would be sometimes very helpful if one can see
> also arguments supplied to generic method in traceback output:
>
> raise NoApplicableMethods(args)
>
> instead of
>
> raise NoApplicableMethods
>
> RadekK
--
Ulrich Eck <ueck at net-labs.de>
net-labs Systemhaus GmbH
More information about the PEAK
mailing list