Monday, August 22, 2011

chrome v13 + double-running middleware (django 1.3)

Hi everyone!

I've created a simple middleware for mobile detection and when testing
values in dev console I came up with some pretty strange behavior.
Let's say, I have this simple middleware class:

class MobileRedirect(object):
def process_request(self, request):
print "watchdog"
return None

and of course it's loaded in my settings:

'django.contrib.messages.middleware.MessageMiddleware',
'middleware.mobile_redirect.MobileRedirect',

and when I go into my login page, this is the results I get in
Firefox:

watchdog
[22/Aug/2011 19:08:02] "GET /login/ HTTP/1.1" 200 742
[22/Aug/2011 19:08:02] "GET /static/css/base.css HTTP/1.1"
[22/Aug/2011 19:08:02] "GET /static/css/fonts/OpenSans/Ope
/1.1" 304 0

and this is using Chrome v13:

watchdog
[22/Aug/2011 19:09:41] "GET /login/ HTTP/1.1" 200 742
[22/Aug/2011 19:09:41] "GET /static/css/base.css HTTP/1.1" 2
[22/Aug/2011 19:09:41] "GET /static/css/fonts/OpenSans/OpenS
/1.1" 304 0
watchdog

"watchdog" is printed out twice, when using chrome!! Using IE gives
the same result as FF.. so how on earth is chrome running the
middleware twice??

Can anyone please make a similar test and let me know, if You get the
same problem.. or just tell me, if I'm doing smth wrong here. I'm new
to django..

Thanks in advance

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate