Thanks Dieter, it's work. But i have a problem with this: When I ran the test python script (see below) in Zope or I called the url directly from the browser , I got an error: Error Type: KeyError Error Value: 'SESSION' ##### Python test script ####### from Products.PythonScripts.standard import html_quote request = context.REQUEST RESPONSE = request.RESPONSE session = request.SESSION session.set('VAR',99) This is the simple external event handler script ############ external module to catch session changes ################### def onSessionStart(item, container): from logging import getLogger request = container.REQUEST user = request.AUTHENTICATED_USER.getUserName() LOG = getLogger('DEMO') session = request.SESSION LOG.info( "Item data: %s" % item ) LOG.info( "Request data: %s" % request ) LOG.info( "Session data: %s" % session ) And in the event.log I can see this error: ############# event.log ################################### 2006-10-12T06:31:30 INFO DEMO Item data: id: 11606310900239978636, token: 88659718A2jNi4M24hE, content keys: [] ------ 2006-10-12T06:31:30 INFO DEMO Request data: <h3>form (..) <th>AUTHENTICATED_USER</th><td><SpecialUser 'Anonymous User'></td></tr><tr valign="top" align="left"><th> (...) SESSION</th><td>id: 1160631090023997863 6, token: 88659718A2jNi4M24hE, content keys: []</td></tr><tr valign="top" align="left"><th> (...) ------ 2006-10-12T06:31:30 INFO DEMO Session data: id: 11606310900239978636, token: 88659718A2jNi4M24hE, content keys: [] ------ 2006-10-12T06:31:30 ERROR Zope.SiteErrorLog http://xxx.xx.xxx.xxx:8080/startdemo/test Traceback (innermost last): Module ZPublisher.Publish, line 115, in publish Module ZPublisher.mapply, line 88, in mapply Module ZPublisher.Publish, line 41, in call_object Module Shared.DC.Scripts.Bindings, line 313, in __call__ Module Shared.DC.Scripts.Bindings, line 350, in _bindAndExec Module Products.PythonScripts.PythonScript, line 326, in _exec Module None, line 5, in test - <PythonScript at /startdemo/test> - Line 5 Module ZPublisher.HTTPRequest, line 1231, in __getattr__ Module ZPublisher.HTTPRequest, line 1182, in get KeyError: 'SESSION' What do I wrong? -----Original Message----- From: Dieter Maurer [mailto:dieter@handshake.de] Sent: Wednesday, October 11, 2006 8:43 PM To: Pletli Antal Cc: zope@zope.org Subject: Re: [Zope] How can I store session data to db on login/logoff events ? Pletli Antal wrote at 2006-10-11 15:19 +0200:
... How can I retrieve the user SESSION data when the items are created or deleted from the transient object container?
The "Transient Object Container" (that's the session container) has too scripts for this. You configure them in Zope's configuration file. -- Dieter