RE: [Zope] How can I store session data to db on login/logoff events ?

2006-10-16 Thread Pletli Antal
Thank you Dieter, it is work correctly, i found the session keys!  :-)

-Original Message-
From: Dieter Maurer [mailto:[EMAIL PROTECTED] 
Sent: Friday, October 13, 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-13 08:36 +0200:
I see, but i dont't know why the session is empty. When the session 
will be deleted it is not contains the previously set variables (keys) 
by the user. Only the request object contains the authenticated user 
name, the container.session or item parameter contents the id, 
token values but the  content keys is [].

That is strange.

As you can see
Products.Transience.TransientObjectContainer._do_finalize_work
the session is not cleared before the notifyDel.

The real content might be in item._container which you can access with
the TransientObjects mapping API (keys, values, items, ...)



--
Dieter
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


RE: [Zope] How can I store session data to db on login/logoff events ?

2006-10-13 Thread Pletli Antal
Thank you Dieter,

I see, but i dont't know why the session is empty. When the session will
be deleted it is not contains the previously set variables (keys) by the
user. Only the request object contains the authenticated user name, the
container.session or item parameter contents the id, token values
but the  content keys is [].

-Original Message-
From: Dieter Maurer [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 12, 2006 8:54 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-12 08:50 +0200:
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'

The session object is passed as a parameter to the script when session
created and script when session deleted scripts.



--
Dieter
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


RE: [Zope] How can I store session data to db on login/logoff events ?

2006-10-13 Thread Dieter Maurer
Pletli Antal wrote at 2006-10-13 08:36 +0200:
I see, but i dont't know why the session is empty. When the session will
be deleted it is not contains the previously set variables (keys) by the
user. Only the request object contains the authenticated user name, the
container.session or item parameter contents the id, token values
but the  content keys is [].

That is strange.

As you can see Products.Transience.TransientObjectContainer._do_finalize_work
the session is not cleared before the notifyDel.

The real content might be in item._container which you can
access with the TransientObjects mapping API (keys, values, items, ...)



-- 
Dieter
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


RE: [Zope] How can I store session data to db on login/logoff events ?

2006-10-12 Thread Pletli Antal
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: h3form
(..)
thAUTHENTICATED_USER/thtdlt;SpecialUser 'Anonymous
User'gt;/td/trtr valign=top align=leftth
(...)
SESSION/thtdid: 1160631090023997863
6, token: 88659718A2jNi4M24hE, content keys: []/td/trtr
valign=top align=leftth
(...)
--
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:[EMAIL PROTECTED] 
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
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] How can I store session data to db on login/logoff events ?

2006-10-12 Thread Sascha Ottolski
Am Donnerstag, 12. Oktober 2006 08:50 schrieb Pletli Antal:
 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'

we've seen this problem regulary, and work around it like so:

def getSession(self):
 
try:
session = request.SESSION
except KeyError:
session = self.session_data_manager.getSessionData()

return session


Cheers, Sascha


-- 
Lalisio GmbH                                          www.lalisio.com

Puschkinstraße 1                             fon +49-(0)361/541 43 80
99084 Erfurt                                 fax +49-(0)361/541 43 79
                                                 [EMAIL PROTECTED]

+
AKTUELLER HINWEIS (Oktober 2006)

Wussten Sie schon, dass Lalisio ab sofort den Dokumentenlieferdienst 
CISTI in seine Literatursuchmaschine einbindet? Sobald Sie über 
unsere Literatursuchmaschine in den Datenbanken Ingenta oder Projekt 
MUSE relevante Artikel finden, können Sie die bibliographischen Daten
per Mausklick an CISTI übermitteln und Kopien der Artikel bestellen. 

Testen Sie unser Angebot unter www.lalisio.com!
+
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


RE: [Zope] How can I store session data to db on login/logoff events ?

2006-10-12 Thread Dieter Maurer
Pletli Antal wrote at 2006-10-12 08:50 +0200:
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'

The session object is passed as a parameter to the
script when session created and script when session deleted scripts.



-- 
Dieter
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] How can I store session data to db on login/logoff events ?

2006-10-11 Thread Dieter Maurer
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
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )