[Zope] Re: HappySession
Fri, 01 Sep 2000 13:30:11 +0200
I also use HappySession and when catching the SessionNotFoundError
weird things happen:
here my code:
When the session is expired the error is not caught correctly and I get the error mentioned below. Plus, I have to restart my server because ZODB reports a transactional error and sets itself to read-only.
Philipp Auersperg (zwork)
Zope has encountered an error while publishing this resource.
Error Type: KeyError
Error Value: SessionUID
and the traceback:
Traceback (innermost last):
File /usr/local/Zope-2.1.4-linux2-x86/lib/python/ZPublisher/Publish.py, line 214, in publish_module
File /usr/local/Zope-2.1.4-linux2-x86/lib/python/ZPublisher/Publish.py, line 179, in publish
File /usr/local/Zope-2.1.4-linux2-x86/lib/python/Zope/__init__.py, line 202, in zpublisher_exception_hook
File /usr/local/Zope-2.1.4-linux2-x86/lib/python/ZPublisher/Publish.py, line 169, in publish
File /usr/local/Zope-2.1.4-linux2-x86/lib/python/ZODB/Transaction.py, line 275, in commit
File /usr/local/Zope-2.1.4-linux2-x86/lib/python/Shared/DC/ZRDB/TM.py, line 120, in tpc_finish
File /usr/local/Zope-2.1.4-linux2-x86/lib/python/Products/HappySession/HappySession.py, line 168, in _finish
File /usr/local/Zope-2.1.4-linux2-x86/lib/python/Products/HappySession/HappySession.py, line 291, in _onTransactionEnded
File /usr/local/Zope-2.1.4-linux2-x86/lib/python/Products/HappySession/HappySession.py, line 255, in _store
KeyError: (see above)
*********** REPLY SEPARATOR ***********
On 31.08.2000 at 19:03 Hung Jung Lu wrote:
>My conjecture now is that your error-handling HTML might be accessing
>attributes from Zope server. A more correct way of handling exceptions
>should have been using the <dtml-try>...<dtml-except>...</dtml-try> block.
>But I kind of make a cheat sheet recipe recommendation, tweaking the
>standard_error_message, which was not a good idea. When Zope arrives to
>standard_error_message, the transaction has been aborted and if your
>session_not_found_html is not simple enough and uses more DTML features, I
>can see that it can cause transaction error.
>Can you send me your session_not_found_html? I think this was the problem.
>In the future I will remove the standard_error_message trick from the help
>file and instead tell people to use proper exception handling, which is the
>right way of doing things. But it will require people to structure their
>sites more carefully so they can catch the SessionNotFound exception.
>Basically, it is recommended that you have single (or few) index_html on
>your site, and place a <dtml-try>...<dtml-except ...>...</dtml-try> block to
>capture all exceptions from Zope and deal with them. It's the right way of
>doing things, it's just that many people tend to have many index_html and it
>will make their site harder to catch exceptions and deal with them in a
>In short, HappySession itself is probably not the cause of the transaction
>error. The problem probably comes from bad exception handling. If you want
>to use the standard_error_message trick, then please use a simple html page
>for session_not_found_html without additional Zope features. If I find out
>more, I'll let you know.
>Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
>Share information about yourself, create your own public profile at
>Zope maillist - Zope@zope.org
>** No cross posts or HTML encoding! **
>(Related lists -
> http://lists.zope.org/mailman/listinfo/zope-dev )