[Zope] accessing session data error

Leticia Larrosa LETICIA at tesla.cujae.edu.cu
Mon Jun 20 16:25:08 EDT 2005


Hi:

 Thanks for the rapid aswer of Chris McDonough. I will change the steps to 
replicate the error (sorry for the large steps before :( , I thinks that 
maybe was needful). Remember that the key of the error is the time interval 
between the request. If with 5 seconds don't appear the error try to vary to 
other, like 7 seconds. The 5 first steps are to create the situation and the 
sixth step are to provoke the error

Step 1: Create a folder called "reproducingError" in Zope Interface
Manage

Step 2: Create a srcipt "end" with the content:
"
# end script
idService = context.REQUEST.SESSION['idService']
return "Fin - " + idService
"

Step 3: Create a script "index_html" with the content:
"
# init script
sessionData = container.REQUEST.SESSION
sessionData.set("userId", "userExample")
return context.init2()
"

Step 4: Create a script "init2" with the content:
"
# init2 script
request = context.REQUEST
sessionData = request.SESSION
sessionData.set('idService', 'testService')
return context.external(context)
"

Step 5:create an external method called "external" in the "reproducingError" 
folder with the following content, in where the
function of the external method is "communicationResponse" and the module is 
any name that you give to the file:
"
# external method
import time
def communicationResponse(context):
    response = context.REQUEST.RESPONSE
    sessionData = context.REQUEST.SESSION
    strDetailEnd = "<script>window.location='reproducingError/end'</script>"
    
    for item in range(1, 40):
        time.sleep(3)
        response.write("Response iteration:" + str(item))
        response.flush()
    response.write(strDetailEnd)
    response.flush()
"

Step 6: open two explorer
In one of them call the object "reproducingError" (Example: 
localhost:8080/reproducingError), then wait 5 second and put in the other 
the same direction.
And wait the iterations....

Note: I count 5 second, not with chronometer. You can try with a near 
number.

Chris: I reproduce the error with the steps. I can't reduce it to an 
external method. Thanks again.

The error that I obtain is the same:
"
Traceback (innermost last):
  Module ZPublisher.Publish, line 101, in publish
  Module ZPublisher.mapply, line 88, in mapply
  Module ZPublisher.Publish, line 39, in call_object
  Module Shared.DC.Scripts.Bindings, line 306, in __call__
  Module Shared.DC.Scripts.Bindings, line 343, in _bindAndExec
  Module Products.PythonScripts.PythonScript, line 323, in _exec
  Module None, line 2, in end
   - <PythonScript at /approach/reproducingError/end>
   - Line 2
  Module AccessControl.ZopeGuards, line 67, in guarded_getitem
  Module Products.Transience.TransientObject, line 176, in __getitem__
KeyError: 'idService'

"
Remember:
> > A curious thing is that when I obtain the error, if I wait around 15
> > second and refresh the page in wich i obtain the error, the correct
> > result appear.. and no errors come.

> > I'm using Zope 2.7.6 for Windows.


I must solve this, because this is part of my thesis for university 
graduation. Any help will be appreciated.

Thanks in advance, 
Leticia Larrosa


-----Original Message-----
From: Chris McDonough <chrism at plope.com>
To: Leticia Larrosa <LETICIA at tesla.cujae.edu.cu>
Cc: zope at zope.org
Date: Mon, 20 Jun 2005 15:12:21 -0400
Subject: Re: [Zope] accessing session data error

> Hi Leticia,
> 
> Thanks for the detailed bug report.
> 
> I have tried to replicate the bug as you indicate below but cannot.
> I've gone through the process you describe ten times without errors (in
> Zope 2.7.6).
> 
> If it's possible to simplify the steps to recreate the error, that
> would
> be helpful in further debugging (for example, maybe just getting rid of
> all the page templates and python scripts and just using a single
> external method).
> 
> - C
> 
> 
> On Mon, 2005-06-20 at 14:20 -0400, Leticia Larrosa wrote:
> > Hi all:
> >  
> > I think that I found a ZOPE bug. Is really very important for me know
> > what can I do for avoid it. The first 9 steps are to recreate the
> > situation and the other steps are to provoke the error.
> >  
> > Step 1: Crate a folder called "reproducingError" in Zope Interface
> > Manage
> >  
> > Step 2: create a page template called "index_html" in the
> > "reproducingError" folder with the following content:
> > "
> > <!-- index_html page template -->
> > <form name="form1" method="post" action="reproducingError/init">
> >   <input type="text" name="user">
> >   <input type="submit" name="Submit" value="Submit">
> > </form>
> > "
> >  
> > Step 3: create a python script called "init" in the
> "reproducingError"
> > folder with the following content:
> > "
> > # init script
> > sessionData = container.REQUEST.SESSION
> > sessionData.set("userId", container.REQUEST.user)
> > return context.init2_html()
> > "
> >  
> > Step 4: create a page template called "init2_html" in the
> > "reproducingError" folder with the following content:
> > "
> > <!-- init2_html page template -->
> > <a href="init2">passing face 2</a>
> > "
> >  
> > Step 5: create a python script called "init2" in the
> > "reproducingError" folder with the following content:
> > "
> > # init2 script
> > request = context.REQUEST
> > sessionData = request.SESSION
> > sessionData.set('idService', 'testService')
> > context.first()
> > return context.external(context)
> > "
> >  
> > Step 6: create a page template called "first_html" in the
> > "reproducingError" folder with the following content:
> > "
> > First Response
> > "
> >  
> > Step 7: create a python script called "first" in the
> > "reproducingError" folder with the following content:
> > "
> > # first script
> > response = container.REQUEST.RESPONSE
> > str = container.first_html()
> > response.write(str)
> > response.flush()
> > "
> >  
> > Step 8: create an external method called "external" in the
> > "reproducingError" folder with the following content, in where the
> > function of the external method is "communicationResponse" and the
> > module is any name that you give to the file:
> > "
> > # external method
> > import time
> > def communicationResponse(context):
> >     response = context.REQUEST.RESPONSE
> >     sessionData = context.REQUEST.SESSION
> >     strDetailEnd =
> > "<script>window.location='reproducingError/end'</script>"
> >     
> >     for item in range(1, 40):
> >         time.sleep(3)
> >         response.write("Response iteration:" + str(item))
> >         response.flush()
> >     response.write(strDetailEnd)
> >     response.flush()
> > "
> >  
> > Step 9: create a python script called "end" in the "reproducingError"
> > folder with the following content:
> > "
> > # end script
> > idService = context.REQUEST.SESSION['idService']
> > return "Fin - " + idService
> > "
> >  
> > Step 10: open two explorer in wich call the object
> > "reproducingError" (Example: localhost:8080/reproducingError)
> >  
> > Step 11: enter an example text in each one.
> >  
> > Step 12: clink in the link of one of them, and 5 second later clink
> on
> > the link of the other explorer. The waiting for around 5 second is
> > necesary because with other time interval not allways get the error.
> >  
> > Stpe 13: and wait the "Response iteration"...  Please if the error
> > don't appear in any of the pages, begins at Step 9 again. and try to
> > count to 5 witch other velocity :)
> >  
> > The correct result is:
> > "
> > Fin - testService
> > "
> >  
> > The error is:
> > "
> > Site Error
> > An error was encountered while publishing this resource. 
> > Error Type: KeyError
> > Error Value: 'idService'
> > "
> > The traceback:
> > "
> > Traceback (innermost last):
> >   Module ZPublisher.Publish, line 101, in publish
> >   Module ZPublisher.mapply, line 88, in mapply
> >   Module ZPublisher.Publish, line 39, in call_object
> >   Module Shared.DC.Scripts.Bindings, line 306, in __call__
> >   Module Shared.DC.Scripts.Bindings, line 343, in _bindAndExec
> >   Module Products.PythonScripts.PythonScript, line 323, in _exec
> >   Module None, line 2, in end
> >    - <PythonScript at /approach/reproducingError/end>
> >    - Line 2
> >   Module AccessControl.ZopeGuards, line 67, in guarded_getitem
> >   Module Products.Transience.TransientObject, line 176, in
> __getitem__
> > KeyError: 'idService'
> > "
> >  
> > I will appreciate if you try until the error appear, because I not
> > always obtain the error. I thinks that it is bacause the time
> interval
> > between the two request.
> >  
> > A curious thing is that when I obtain the error, if I wait around 15
> > second and refresh the page in wich i obtain the error, the correct
> > result appear.. and no errors come.
> >  
> > Sorry for the extended message, but I need any help that you can give
> > me, because this describe error environment imitate a funcionality
> > that I must give in a system very import that i'm doing.
> >  
> > I'm using Zope 2.7.6 for Windows.
> >  
> > Thanks in advanced.
> > Leticia
> > _______________________________________________
> > Zope maillist  -  Zope at 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 )
> 
> 
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20050620/373d9751/attachment.htm


More information about the Zope mailing list