Re: How to include session data in traceback
D'oh. Thanks. I was confusing load and loads. I thought they were the same thing. On Apr 30, 12:55 pm, Malcolm Tredinnick wrote: > On Thu, 2009-04-30 at 09:47 -0700, Brian Morton wrote: > > Thanks. That makes perfect sense. Since my session data is persisted > > in the db (and I don't have a cleanup script active at the moment), I > > can retrieve the pickled session data based on the session id in the > > cookie (that is in the traceback). The problem is decoding that > > session data. Can the pickle module accept a string as input and > > output the unpickled data? I know it does it with file objects via > > load, but I can't find any reference on how to do this with a string. > > The documentation for the pickle module tells all. :-) > > http://docs.python.org/library/pickle.html#pickle.loads > > Regards, > Malcolm --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: How to include session data in traceback
On Thu, 2009-04-30 at 09:47 -0700, Brian Morton wrote: > Thanks. That makes perfect sense. Since my session data is persisted > in the db (and I don't have a cleanup script active at the moment), I > can retrieve the pickled session data based on the session id in the > cookie (that is in the traceback). The problem is decoding that > session data. Can the pickle module accept a string as input and > output the unpickled data? I know it does it with file objects via > load, but I can't find any reference on how to do this with a string. The documentation for the pickle module tells all. :-) http://docs.python.org/library/pickle.html#pickle.loads Regards, Malcolm --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: How to include session data in traceback
Thanks. That makes perfect sense. Since my session data is persisted in the db (and I don't have a cleanup script active at the moment), I can retrieve the pickled session data based on the session id in the cookie (that is in the traceback). The problem is decoding that session data. Can the pickle module accept a string as input and output the unpickled data? I know it does it with file objects via load, but I can't find any reference on how to do this with a string. On Apr 30, 12:43 pm, Malcolm Tredinnick wrote: > On Thu, 2009-04-30 at 04:58 -0700, Brian Morton wrote: > > I am considering filing an enhancement request but I want to check > > first to make sure this functionality doesn't already exist. > > > Is there some way to make Django include the contents of session in > > the traceback email received from a 500 error? > > It's not possible to guarantee that that information will be available > or that trying to get that information won't cause further errors. A 500 > error is because of an entirely unexpected problem and could potentially > be caused by anything, so Django should do the absolute minimum to get > out of there at that point -- talking to the database for session data > (which is still the common case for storing sessions) is not the > minimum. > > However, if you want to write your handling for those unexpected errors, > you can subclass the django.core.handlers.* class that you're using and > override the handle_unexpected_exception() method to do whatever you > would like. That's why that method is separated out. > > Regards, > Malcolm --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: How to include session data in traceback
On Thu, 2009-04-30 at 04:58 -0700, Brian Morton wrote: > I am considering filing an enhancement request but I want to check > first to make sure this functionality doesn't already exist. > > Is there some way to make Django include the contents of session in > the traceback email received from a 500 error? It's not possible to guarantee that that information will be available or that trying to get that information won't cause further errors. A 500 error is because of an entirely unexpected problem and could potentially be caused by anything, so Django should do the absolute minimum to get out of there at that point -- talking to the database for session data (which is still the common case for storing sessions) is not the minimum. However, if you want to write your handling for those unexpected errors, you can subclass the django.core.handlers.* class that you're using and override the handle_unexpected_exception() method to do whatever you would like. That's why that method is separated out. Regards, Malcolm --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
How to include session data in traceback
I am considering filing an enhancement request but I want to check first to make sure this functionality doesn't already exist. Is there some way to make Django include the contents of session in the traceback email received from a 500 error? It is very useful in the case of debugging an error with the session (say, a missing key). I cannot find any reference to this in the docs. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---