Re: Schema provider/CA lookup status

Martin Aspeli <[email protected]> Fri, 14 Jul 2006 17:48:26 +0100
Newsgroups gmane.comp.web.zope.plone.archetypes.devel
Message-ID <[email protected]>
Rob Miller wrote:

> how about just putting a marker interface on your objects so they can get
> a different adapter that provides ISchema?  i see two ways to do this:
> 
> 1. apply the marker interface to each object at the same time you
> establish the reference to the 'charity' object, with your adapter
> automatically invoking the original adapter and then appending extra
> fields of its own

I'm not really envisaging this as having a 'charity' object at all. 
Perhaps that'd be a different design idea (but I don't quite see how 
it'd work). The idea is that by installing 'charity', I signal that the 
Employee object now has a bunch of charity-specific fields, and a 
charity-specific view template (just a skin layer override).

I'm not a fan of doing things like this on-object-creation-event, 
though, it seems quite brittle...

> 2. apply the marker interface to the class, and have the adapter check to
> see if a reference to a 'charity' object exists, serving the extended
> schema if so, the core schema if not.
> 
> i'd lean towards #2, i think.

... so I guess you'd agree. I think the idea of using the original 
adapter and then letting the 'charity' adapter go second is interesting. 
I'll have to think about it. It seems to invert the relationship, 
though, in that 'charity' would register an adapter that would have to 
*know* that it should go look at the original adapter and then do the 
appending. So:

  - it's not enforced that the appending would happen - this would 
belong in the 'company' package, since that's where the assumption is 
made that those fields are always there

  - the actual way of merging the schema would not be generalised (or 
would have to be generalised to another component); again, 'company' may 
want to enforce that more strictly if it makes assumptions based on it.

Martin

> does this sound like it would work?  it certainly seems simpler than what
> you've proposed.




-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642