[Zope3-dev] should the view lookup machinery call getAdapter?

Casey Duncan casey@zope.com
Mon, 01 Apr 2002 17:40:39 -0700


R. David Murray wrote:
 > On Mon, 1 Apr 2002, Casey Duncan wrote:
 >
 >><browser:view name="RolePermissionsManagement"
 >>               for="Zope.App.OFS.Memento.IMementoStorable."
 >>               factory="Zope.App.Security.RolePermissionView." />
 >>
 >
 > Using the inheritence hierarchy to solve this is elegant.
 >
 > One question:  how would the following hypothetical (but probably
 > essential) adapter play into your scheme?
 >
 > <adapter
 > 	factory="Zope.App.OFS.Memento.ObjectHubMementoBag."
 > 	provides="Zope.App.OFS.Memento.IMementoBag."
 > 	/>

In that case the objects being managed would simply need to implement 
IObjectHubMementoStorable (which derives from IMementoStorable). This 
would, of course, need to be implemented somewhere 8^).

Another thought is that given how generic memento storage is, it would 
be cool to have more specific interfaces by function. That way you 
could, for example, use LDAP for security settings, and mementos for 
everything else (something you can't currently do, at least not easily). 
In that case I might define interfaces like:

IMementoSecurityStorage
IObjectHubSecurityStorage
ILDAPSecurityStorage

Then you could have a case like:

__implements__ = (IObjectHubSecurityStorage, IMementoFooStorage)

Another thing that troubles me is that implementing IMementoStorable 
really gives carte blanc to anything wanting to stick mementos in an 
object. This would be alleviated with the finer grained interfaces 
above. To alleviate the bloating of interfaces being implemented by 
everything, you could still have a general IMementoStorable to tell Zope 
to store everything in mementos.

OTOH, don't we really want an object to say: Just store my damn security 
settings for me. In which case you could have something like:

__implements__ = ISecurityManageable

Which means "Store security settings however you want to for me", the 
exact method being set in a zcml file. And you could also have 
IMementoSecurityManageable and ILDAPSecurityManageable et al, so that 
the class could be much more choosey if it pleased.

Thoughts?

-Casey