[Zope-dev] Events and interfaces for different request types

Roger Ineichen dev at projekt01.ch
Wed Sep 10 17:09:02 EDT 2008


Hi

Sidnei 

> Betreff: [Zope-dev] Events and interfaces for different request types
> 
> Hi all,
> 
> More than once I've found myself on a situation where I 
> needed to subscribe to a specific event but only if it 
> happens through a specific request type. One problem with 
> that is that commonly the request is not part of the event 
> information. Another problem might be that the request type 
> might not be properly flagged, but this is a different 
> subject and applies mostly to Zope 2.
> 
> Now, for solving this problem, I usually create a custom and 
> more specialized event that includes the request as part of 
> it's information. So, for example, I'm interested in 
> IObjectModifiedEvent but only for IWebDAVRequest, then I create:
> 
> class IObjectRequestModifiedEvent(IObjectModifiedEvent):
>    request = Attribute(...)
> 
> def subscriber(object, event):
>    if IWebDAVRequest.isProvidedBy(event.request):
>       # do something
> 
> Now, I wonder if someone has any suggestion on how to 
> simplify this further...

I personaly think the request which is almost only a user 
interaction should not be a part of the model. The 
basic event subscribers will act at the (MVC) model level
independent of what user will interact and independent from
the different user interfaces e.g. web browser web dav etc.

But I see your point. I think what is missing is some
kind of view events. Because the API which web dav uses
is implemented as views, right?

I also think this is probably special for FTP and Web Dav
but not required in web browser views.


Regards
Roger Ineichen
_____________________________
END OF MESSAGE


> --
> Sidnei da Silva
> Enfold Systems http://enfoldsystems.com
> Fax +1 832 201 8856 Office +1 713 942 2377 Ext 214 
> _______________________________________________
> Zope-Dev maillist  -  Zope-Dev at zope.org
> http://mail.zope.org/mailman/listinfo/zope-dev
> **  No cross posts or HTML encoding!  ** (Related lists -  
> http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope )
> 



More information about the Zope-Dev mailing list