Re: [Zope] Re: HappySession
Hi! I do not have any reference to HappySession in my headers. I enclosed the session.set(..) in dtml-try in order to catch the SessionNotFoundError, your slution just tests if the item exists in the session but does it prevent from the SessionNotFoundError exception? thanks phil *** REPLY SEPARATOR *** On 01.09.2000 at 08:15 Hung Jung Lu wrote: From: "Philipp Auersperg" [EMAIL PROTECTED] I also use HappySession and when catching the SessionNotFoundError weird things happen: here my code: dtml-try dtml-call "SESSION.set('FLinkID','0')" dtml-except session error! /dtml-try 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. I would guess you have the same problem as Diego Rodrigo... could you check your standard_html_header? Does it make any reference to SESSION? One thing about HappySession is that I made it so no initialization is required. So please do not call SESSION object in standard_html_header to initialize it. (In the next release I'll make it safe even if someone calls it in standard_html_header.) I will try to guess what you want to do: you want to initialize FLinkID at the beginning of the session? If so, since HappySession's dictionary does not require initialization, you can do something like: dtml-if "SESSION['FLinkID'] == _.None" dtml-call "SESSION.set('FLinkID', 0)" dtml-else ... normal operation here ... /dtml-if (If an item does not exist, SESSION['FLinkID'] returns ._None) regards, Hung Jung _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. Share information about yourself, create your own public profile at http://profiles.msn.com. ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Re: HappySession
I also use HappySession and when catching the SessionNotFoundError weird things happen: here my code: dtml-try dtml-call "SESSION.set('FLinkID','0')" dtml-except session error! /dtml-try 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. thanks Philipp Auersperg (zwork) --- Zope Error 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 (Object: ElementWithAttributes) 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 (Object: TM) File /usr/local/Zope-2.1.4-linux2-x86/lib/python/Products/HappySession/HappySession.py, line 168, in _finish (Object: TM) File /usr/local/Zope-2.1.4-linux2-x86/lib/python/Products/HappySession/HappySession.py, line 291, in _onTransactionEnded (Object: SESSION) File /usr/local/Zope-2.1.4-linux2-x86/lib/python/Products/HappySession/HappySession.py, line 255, in _store (Object: SESSION) 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 centralized way. 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. regards, Hung Jung _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. Share information about yourself, create your own public profile at http://profiles.msn.com. ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] Re: HappySession
Well, this problem just accours when I restart the server or I stay too much time idle and the session expires... The frame[0] (the first to be loaded) show a session not found message and in frame[1] I got this error: Error Type: KeyError Error Value: NDxCfgEr_89YtG So, if I refesh the page zope show me the transaction error and everything stops working I need to restart zope and my netscape (to clean all cookies) to get things working again Here's my session not found page but this error occours when I doesnt have one too... well, in the standard html header I call call a method that do a call in all my sessions I have two SESSION objects, one in the root of zope and other in the opt folder of zope look how I call the SESSIONS in standard_html_header dtml-call callSession The callSession method: dtml-call SESSION dtml-call opt.SESSION session_not_found_html: dtml-var standard_html_header font face=Arial size=2 O tempo maacute;ximo de duraccedil;atilde;o foi ultrapassado.br Os items existentes no seu carrinho foram apagados.brbr Continue suas compras normalmente agora... /font dtml-var standard_html_footer On Thu, 31 Aug 2000, you 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 centralized way. 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. regards, Hung Jung _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. Share information about yourself, create your own public profile at http://profiles.msn.com. -- --- Diego Rodrigo Neufert -webmaster --- (Magic Web Design) (email) ([EMAIL PROTECTED]) (curitiba) (pr) ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] Re: HappySession
From: Diego Rodrigo Neufert [EMAIL PROTECTED] ... too... well, in the standard html header I call call a method that do a call in all my sessions Okie, now I see why you get the Transaction error problem. After an exception is raised, Zope aborts the http request transaction, and any attempt to further use Zope objects that are transaction-aware will cause an error. In the next release of HappySession I will try to detect whether the transaction has ended, and return some meaningless result like None. But the real thing is, after the exception happens, SESSION object should not be called again. If you really need to call SESSION in your standard_html_header, then please do two things: (1) Please use a standard_error_message, and it should start with something like: dtml-if "not error_message and error_type == 'SessionNotFoundError'" dtml-return session_not_found_html /dtml-if !--#var standard_html_header-- !--#if error_message-- !--#var error_message-- !--#else-- (2) In your session_not_found_html, please do NOT use dtml-var standard_html_header. Instead, write another DTML and call it session_ended_html_header, and use it instead. Inside your session_ended_html_header, please do NOT call the SESSION object. I have two SESSION objects, one in the root of zope and other in the opt folder of zope look how I call the SESSIONS in standard_html_header dtml-call callSession The callSession method: dtml-call SESSION dtml-call opt.SESSION (Hmmm... multiple SESSION objects... in typical situations usually one single SESSION object should be enough. Notice that two SESSION objects mean two separate storage. Although HappySession is designed to handle multiple SESSION objects sharing the same key cookie, the expiration time might be a tricky issue... I do not recommend multiple SESSION objects.) The thing I don't understand is why you need to make explicit call to the SESSION objects. Ohh...! I see, you probably think that SESSION objects need to be initialized? OK, unlike FSSession or SQLSession, HappySession's SESSION objects do NOT need to be initialized! You don't need to make an explicit call to SESSION in your standard_html_header. HappySession is smart enough to initialize itself whenever you touch it the first time using any of its methods. No explicit initialization call needed. (I'll add an observation on this in the help file in the future.) - In short, I think that by simply removing your callSession method and its reference in standard_html_header, you will be fine and happy! :) regards, Hung Jung _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. Share information about yourself, create your own public profile at http://profiles.msn.com. ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] Re: HappySession
--- In [EMAIL PROTECTED], Diego Rodrigo Neufert [EMAIL PROTECTED] wrote: I'm making a site with frames with session management. I'm using HappySession to do it... I need to call SESSION['something'] in various frames at the same time, but when a SESSION expire I got a Transaction Error that blow up my Zserver... Anyone know how to solve this or another SESSION product that doesnt have that problem? Arghh! Sorry about that. It made you very unhappy, I guess. :( Please try SQLSession and FSSession. I'll go dig into the problem. Could you provide a little bit more details? Anything will help. (Is your server Unix of Windows based? Have you had more then one crash?) obrigado, Hung Jung _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. Share information about yourself, create your own public profile at http://profiles.msn.com. ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] Re: HappySession
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 centralized way. 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. regards, Hung Jung _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. Share information about yourself, create your own public profile at http://profiles.msn.com. ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] Re: HappySession-0.1.1 available
Sorry, the URL should be: http://www.zope.org/Members/hungjunglu/Products/HappySession Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )