[Zope3-dev] What about a personal per-object namespace instead of a session?

Joachim Werner joe@iuveno-net.de
Mon, 25 Nov 2002 03:28:54 +0100 (CET)


Hi!

When I tested out Shane's new drag&drop boxes today I remembered an old idea: 
Shane suggested that we are going to need some kind of user preferences 
infrastructure to make the boxes' positions persistent.

Usually you'd solve that kind of problems using a session. Then you'd store 
the positions of all these boxes in the session. This session could be kept 
persistent if the idea was to use it for user preferences rather than session 
preferences.

>From a programmer's point of view these sessions are not very comofortable: 
You'll have to make sure that all your boxes have unique identifiers, so you 
can store their position, status (hidden, visible, ...), etc.

It would be much more comfortable if Zope provided us with a magic 
personalized namespace for objects.

I'll use Zope2 syntax because I am not so fluent in Zope3 syntax yet: Let's 
say we have a folder that contains all the boxes in our page. We might then do 
things like (syntax is just a suggestion):

myFolder.session[AUTHENTICATED_USER].objectIds()

to get the box listing in the order specific to the user, or  

myFolder.session[AUTHENTICATED_USER].searchBox.lastSearchTerm

or do things like that:

if "myFolder.actions.session[AUTHENTICATED_USER].status == 'hidden'":
    render myFolder.actions()

I don't know how hard it would be to do this (the AUTHENTICATED_USER could 
also be replaced by something more "sessionish" for the cases where the user 
has a session but is anonymous), but it definitely would be a cool thing to 
have around.

Any comments?

Joachim