[Zope] accessing session data error

Chris McDonough chrism at plope.com
Mon Jun 20 15:12:21 EDT 2005


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 )



More information about the Zope mailing list