[Zope-CMF] Remembering things about members

Shane Hathaway shane@digicool.com
Fri, 11 May 2001 12:25:42 -0400


Jonathan Corbet wrote:
> Work continues on my "make CMF look like LWN" project.
> 
> Among other things, LWN news items carry a "category" attribute (like
> "kernel").  I've created a derivative NewsItem with that attribute, and a
> CategoryTool class for managing categories.  So far so good.

Excellent!

> I would like to let members set up category filters so that they see only a
> subset of the news.  For example, a surprising number of people don't want
> to see security-related items.  It seems that it should be possible to set
> up a filter property in the MemberData class, and perhaps even feed it
> directly to the catalog when looking up stuff to display.

You should be able to do this through the management interface.  Make
the "filter" property a "tokens" or "lines" type.

> But I'm most curious about one thing: the "portal_skin" property is handled
> through a cookie, rather than by querying the membership database.  That
> means that it doesn't carry across browsers or systems.  I figure there
> must be a good reason for this implementation, and I would like to
> understand that that reason is before I start adding properties of my own.
> Does anybody have a clue they could lend me on this one?

It's a workaround for a Zope implementation detail.  At the point we
have to choose what skin the user will see, the authentication process
has not yet begun.  But cookies are available.

However, notice what happens in a standard CMF setup when you log in
using a different browser or different computer: it checks the
portal_skin property of the member and if it is different from the
current cookie, it changes the cookie value.  Or... wait a minute...

Jens just found and fixed a bug in this code.  Currently it only sets
the cookie if it has been previously set, which isn't enough.  The
change is in SkinsTool.updateSkinCookie(); the "cookie is not None"
condition was habitual and isn't there in the current sources.  (Thanks
Jens!)

Shane