On Monday, 22 August 2011 18:17:09 UTC+1, mcrk wrote:
>
> 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


Chrome is probably making a request for /favicon.ico, which is being routed 
through your middleware.
--
DR. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/dMzQekzzDBsJ.
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.

Reply via email to