Turns out the problem was my own fault. My process_response() wasn't
handling exceptions properly. I changed it from this:
def process_response(self, request, response):
self.activity.set_request_time()
return response
to this:
def process_response(self, request, response):
try:
self.activity.set_request_time()
except:
pass
return response
and that took care of it.
On May 28, 7:19 pm, Josh <[EMAIL PROTECTED]> wrote:
> I created a custom middleware for logging requests based on this blog
> post:http://whijo.net/blog/brad/2007/07/19/statistics-logging-django.html
>
> It's mostly working fine except for one thing. It causes problems when
> a URL without a trailing / is requested. In that case it gives me the
> following error:
> File "/home/bostonchefs/webapps/django/bostonchefs/logging/
> middleware.py", line 32, in process_response
> self.activity.set_request_time()
>
> AttributeError: 'Activity' object has no attribute 'activity'
>
> I'm pretty sure htis is just evidence that my middleware isn't playing
> nice with CommonMiddleware, but I'm not sure the best way to go about
> solving it. Is it just an issue of which is loaded first? I'd assume
> that CommonMiddleware should be loaded first so that it can handle the
> slash problem before the request even makes it to my middleware, but
> that appears to not be the case.
>
> This is what my MIDDLEWARE_CLASSES looks like:
> MIDDLEWARE_CLASSES = (
> 'django.middleware.common.CommonMiddleware',
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware',
> 'django.middleware.doc.XViewMiddleware',
> 'django.middleware.http.SetRemoteAddrFromForwardedFor',
> 'myproject.logging.middleware.Activity',
> )
>
> Anyone have any ideas?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---