[Zope3-dev] Re: Status of homefolders?

Stephan Richter srichter at cosmos.phy.tufts.edu
Thu Dec 9 08:50:27 EST 2004


On Thursday 09 December 2004 08:00, Joachim Werner wrote:
> > There may be no standard way to STORE those properties, though, but some
> > sort of directory (as with CPS) is probably the right way to go.
>
> In many larger setups you'll have an external user and address data
> source (LDAP or an SQL database) in the background. So it's really
> important to think about this issue in terms of a generic user/member
> API, but allow different backend implementations.
>
> E.g. I might get my users and the core address data from LDAP, but want
> to store long-term "session" data (like preferences) on that user. In
> another scenario there is no LDAP server and all the data has to be
> stored within Zope. The "annotations" approach seems to be the most
> interesting way to go for that.

I think that Zope 3 is moving away from large feature-rich APIs to very 
generic and simple ones. Instead it uses (and will use even more) the event 
model to extend functionality. Here are three ways you can effectively enrich 
the user without building an extensive API:

1. Principal Annotations: Just store your data there. This will store any data 
in the ZODB.

2. Adapters: You can simply write an adapter for the principal that knows 
where to get more information from, maybe even using a helper utility.

3. Events: You can subscribe to the PrincipalCreatedEvent and add data to the 
principal. This data will not be permanent, since the principal isntance is 
destroyed after the request. This particular method works only well for 
read-only data.

Of course, combining the approaches will yield the best result. Personally, I 
would never access an annotation directly from user code. Instead I would 
write an adapter that uses the annotations to provide information. Another 
approach would be to subscribe to the principal created event and give the 
principal a marker interface, such as ILDAPMember. You then have an adapter 
from ILDAPMember --> ILDAPMemberInformation that knows how to extract the 
data.

Clearly, a content management system built on top of Zope 3 should standardize 
on one way to do it and provide some default mechanism for some common/basic 
meta-data about a member. Thanks to the component architecture, anyone can 
later come and change the default implementation to their liking.

Regards,
Stephan

-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training


More information about the Zope3-dev mailing list