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-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 )


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

2006-10-11 Thread Pletli Antal
 
Hi All!

Sorry for my stupid question and my english:

I would like store some session data to db when the users log into my
zope system and when the session object will be deleted.
When the users log into the system the index_html script sets some data
to request.SESSION object.
I have a script called addScript that runs when an object is added to
transient data container.
In the addScript I try receive data with yyy =
container.SESSION.get('xxx') or item.get() but I cannot see the
keys.
How can I retrieve the user SESSION data when the items are created or
deleted from the transient object container?

Thank you in advance 

Antal
___
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] Problem with running same script at a time

2006-09-22 Thread Pletli Antal
Thank you Dieter!

Here is the exact scenario, which in I first observed the problem:

I have a external zope python module that communicates via TCP with a
background system written in Java.
I have a background system that communicates with the Zope via URL.

I have a demo user folder in my Zope project with two scripts. The first
script sends a tcp message to the background (with the help of external
module), the second one do something when the background call it via
url.

First the Zope script sends a tcp message to background system, and
waits for the reply. The background receives the message and try to call
the url by http request, then if it is success replies to Zope script's
tcp request.
Here is the problem. The background system cannot access the URL  until
in the first script tcp timeout happen.

When I move the second script into other outer folder, all is OK.

It is very strange, and I'v never read from this problem before.

Best regards,

Antal

-Original Message-
From: Dieter Maurer [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 21, 2006 7:46 PM
To: Pletli Antal
Cc: zope@zope.org
Subject: RE: [Zope] Problem with running same script at a time

Pletli Antal wrote at 2006-9-21 09:12 +0200:
 ...
I use the same product. 
This problem is one of the others...

I had to fix a problem in psycopg:

   During connect, Python's Global Interpreter Lock (GIL)
   was not released (freezing Zope during connect).

   Usually, this is not a problem as connect is quite a fast
   operation.

   We noticed it only when the server for the postgres installation
   was down (then connect became a several minute operation
   until the TCP timeout happened).

However, it is unlikely, that this is your problem.

The behaviour is the same when i
use long socket communication (as a tcp client), etc.

This, too, should not happen -- and I never observed it (but a colleague
reported something like this but never showed it to me -- and I did not
believe him; or more precisly, I tested his alledgedly observed
behaviour and could not reproduce it...)

In these cases the
folder wich contains the scripts be unaccessible.

Unbelievable -- unless your folder access triggers the long socket
communication. In this case, it would not be the old socket
communication that blocks but the new one.

Of course, your folder access should not trigger anything else...



--
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] Problem with running same script at a time

2006-09-22 Thread Pletli Antal
Thank you Dieter, I will try it. 

-Original Message-
From: Dieter Maurer [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 22, 2006 8:03 PM
To: Pletli Antal
Cc: zope@zope.org
Subject: RE: [Zope] Problem with running same script at a time

Pletli Antal wrote at 2006-9-22 08:51 +0200:
 ...
I have a demo user folder in my Zope project with two scripts. The 
first script sends a tcp message to the background (with the help of 
external module), the second one do something when the background call 
it via url.

The problem is your setup.

I have to explain a bit that you can understand the problem.

  Zope's request processing has roughly two phases:
  URL traversal to locate the object identified by the URL
  and then calling the located object.

  At the end of URL traversal lies the user authentication.
  This proceeds as follows: Zope starts at the located
  object and looks upward (towards to root) to find
  a User Folder which is ready to authenticate the user
  with the required roles. It will ask each User Folder
  it finds above the object until one gives a positive answer.
  The highest user folder will always return a user, maybe
  the anonymous one.

If your User Folder calls out to a backend system and this backend
system calls back (via URL) into an area controlled by your User Folder,
then you lose -- as the User Folder will again call out and wait for an
answer before it will call the object...

Move the thing called back out of your hiararchy dominated by the
UserFolder. Then, you might have success.



--
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] Problem with running same script at a time

2006-09-21 Thread Pletli Antal
Hi Dieter!

Than you for your answer!
I use the same product. 
This problem is one of the others... The behaviour is the same when i
use long socket communication (as a tcp client), etc. In these cases the
folder wich contains the scripts be unaccessible.
Maybe have i a wrong zope configuration (i use default config)?

Antal

-Original Message-
From: Dieter Maurer [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 20, 2006 9:40 PM
To: Pletli Antal
Cc: zope@zope.org
Subject: Re: [Zope] Problem with running same script at a time

Pletli Antal wrote at 2006-9-20 14:48 +0200:
I have experienced that when i run a python srcipt (it is a long 
postresql query)  from a user folder then i cannot access this folder 
from management form while the process is running. If  i try at the 
same time to run this script again the process will start after the 
other one ends. Other folder are accessible. What do i wrong?

This is surprising...

You might be using an unfortunate Postgres adapter library.

We are using psycopg and do not observe this problem.



--
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] Problem with running same script at a time

2006-09-21 Thread Pletli Antal
My system is a developer server so i'm the only one who use the zope.
When i run the script there is not other worker script.
I'm newbie but i read that there is a tool named zasync that maybe
solves my problem but i cannot install it yet. I would like solve my
problem without this if possible.

Antal

-Original Message-
From: Andreas Jung [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 21, 2006 9:17 AM
To: Pletli Antal; Dieter Maurer
Cc: zope@zope.org
Subject: RE: [Zope] Problem with running same script at a time



--On 21. September 2006 09:12:47 +0200 Pletli Antal
[EMAIL PROTECTED]
wrote:

 Hi Dieter!

 Than you for your answer!
 I use the same product.
 This problem is one of the others... The behaviour is the same when i 
 use long socket communication (as a tcp client), etc. In these cases 
 the folder wich contains the scripts be unaccessible.
 Maybe have i a wrong zope configuration (i use default config)?



Perhaps you're other worker threads are blocked by long-running
requests?

-aj
___
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 )


[Zope] Problem with running same script at a time

2006-09-20 Thread Pletli Antal
Title: Problem with running same script at a time






Hello list,


I use zope2 latest cvs version

I have experienced that when i run a python srcipt (it is a long postresql query) from a user folder then i cannot access this folder from management form while the process is running. If i try at the same time to run this script again the process will start after the other one ends. Other folder are accessible. What do i wrong?

Best regards


Antal



___
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 )