[Zope3-dev] Event module as a file system service--ick?

Gary Poster garyposter@earthlink.net
Sun, 21 Apr 2002 12:27:45 -0400


On Sunday 21 April 2002 05:06 am, Chris Withers wrote:
> Gary Poster wrote:
> > To be honest, I don't like this facade much, and I'm personally happy to
> > get rid of it.  Does anyone mind too much?  Is there a really good reason
> > for this?  I think the Event Service should always be obtained by the
> > ComponentArchitecture, if possible.
>
> I think I wrote that code :-S

Completely blessed approach (see current Twisted framework thread, for 
instance).  The fact that I don't like it is much less important than the 
fact that it makes offering placeful hooks a bit more difficult.   

It really comes down to what we think the user will want to import most 
conveniently from this package: the Event service, or the new placeful hooks 
that use the same function names as the Event service methods.  The placeful 
hooks need a different signature, since they also need context to be placeful.

I think placeful hooks are the winning candidate, and that matches with the 
CA package approach, so I'm hoping to run with it.

With the closer integration with CA I'm working on, if you actually wanted an 
event service, rather than the hooks, you would import the getService hook 
from CA and say "getService(context, 'EventService')" where context can be 
None if you explicitly want the global service.

> ...
> However, I should point out that the module _does_ currently implement
> IEventService, why would you want to make it _not_ implement IEventService?

Because it makes it harder to get the placeful hooks of the same name.

> As to how you get hold of it, yeah, the CA is the 'right' way, but I'm not
> sure what that has to do with the module implementing the service rather
> than a class...

Because the only reason I could see for making the module implement the 
service in this case was for the convenience of being able to say "from Zope 
import Event" and then using Event as the global service.  Was there another 
advantage?

Summary: I'm happy to leave as is, and put the hooks somewhere else, but I 
think the arrangement I propose makes more sense now that we have placeful 
functionality.  Feel free to say no.

Thanks, Chris

Gary