[Zope] zope and session

Bakhtiar A Hamid bak@nstp.com.my
Mon, 15 Jul 2002 09:36:41 +0800


i'd like to do some brain picking with regards to zope and session

currently, i'm enabling session on all pages by using script python [1].
it works ok, but is that the right way of doing it?  and  i sometimes get=
=20
keyerror[2]

also, when enabling sessions, can i get to the data stored in transient o=
bject=20
so that i can, say, see how many people are currently in session, etc, et=
c.

what i'm doing now is storing some of this stuff in postgresql, which is=20
wrong, i think.

thanks for all input

--[1]script python---
session =3D context.REQUEST.SESSION
browsermgr =3D session.getBrowserIdManager()
r=3Dcontext.REQUEST

if session.getBrowserIdManager().isBrowserIdNew():
  session.set(browsermgr.getBrowserIdName(),browsermgr.getBrowserId())

  r.set(browsermgr.getBrowserIdName(),browsermgr.getBrowserId())
  context.q_add_user_session(context, r)#update postgresql to get who's i=
n=20
session
else:
  if _.SecurityGetUser().getUserName() !=3D 'Anonymous User':
    r.set(browsermgr.getBrowserIdName(),browsermgr.getBrowserId())
    context.q_update_user_session(context, r)#update postgresql to get wh=
o's=20
in session

=20
--keyerror [2]
  (Object: session_data)
KeyError: duplicate key 08694963A0YdxjlmPiI
--

--=20

=09http://www.kedai.com.my/             http://www.kedai.com.my/eZine
=09http://www.zope.org/Members/kedai    http://www.my-zope.org
=09How can I laugh tomorrow, if i can't even smile today.