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 django-users@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to