nuxeo-localizer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nuxeo-localizer] user prefered language


From: Juan David Ibáñez Palomar
Subject: Re: [Nuxeo-localizer] user prefered language
Date: Mon, 18 Nov 2002 21:27:04 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020913 Debian/1.1-1



Ok, thanks for that tip. It was there because I've used it before and forget
to remove it...
It motivated me to go further in python, and here is an URL that may be
interesting for other readers of that list :
http://www.python.org/peps/pep-0290.html

Thanks! I didn't knew about this PEP


After further investigations, I found what put me into trouble....
It appears that MSIE (unfortunately used by most of the people in world)
send an HTTP_ACCEPT_LANGUAGE wich is correctly parsed (I've tested version
4.0, 5.5, 6.0) with the accept_language.parse method, but... send an
HTTP_USER_AGENT starting with 'Mozilla/4', thus falling into your
non-complient user agents procedure, which is wrong in that case.

I changed the __init__.py that way :
-------------
   user_agent = request['HTTP_USER_AGENT']
   if (user_agent.startswith('Mozilla/4'))
       and (user_agent.find('MSIE') == -1):
       # Netscape 4.x
-------------
(please note that the test line is broken only for the mail formatting, it's
not break in the actual code)

I don't know what would happen with MSIE < 4.0, I don't have that version...

So, what do you think about it ?


Thanks! It is already in the CVS, I am surprised this bug went
so far.

BTW, you are learning Python very quickly, welcome to the
happy community of Python developers :-)


Regards,

--
J. David Ibáñez, http://www.j-david.net
Software Engineer / Ingénieur Logiciel / Ingeniero de Software






reply via email to

[Prev in Thread] Current Thread [Next in Thread]