[Zope3-dev] What about a personal per-object namespace instead of
a session?
Stephan Richter
stephan.richter@tufts.edu
Sun, 24 Nov 2002 21:47:30 -0500
On Sunday 24 November 2002 21:28, Joachim Werner wrote:
> 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.
Right, I agree that we have this problem and that it will specifically pop up
with a component-oriented GUI. Therefore it is very important to solve it...
> It would be much more comfortable if Zope provided us with a magic
> personalized namespace for objects.
>
<snip>
> myFolder.session[AUTHENTICATED_USER].objectIds()
>
> to get the box listing in the order specific to the user, or
>
> myFolder.session[AUTHENTICATED_USER].searchBox.lastSearchTerm
This solution would assume that all your obejcts are annotable, which might
not be the case. I would therefore propose to change the order a bit:
session[user_id].myFolder.searchBox...
This way the session can build up a namespace as it needs it and not touch the
obejct itself, nor would we need to add hooks to objects to handle this
scenario.
On the other hand, something with the following syntax (URL style) would be
nice:
http://localhost:8080/myFolder/++etc++Session/searchBox/lastSearchTerm
This would be definitely the Zope 3 way to go. Note that we also know the user
automatically, since the ++etc++Session has access to the Request, whcih
contains the user info.
Regards,
Stephan
--
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training