Also, note that you can access user_agent_parser.py by calling request.user_agent(). The nice thing about the latter is that it will store the result in the session (as session._user_agent), so it only needs to parse the user agent once per session. Anthony
On Tuesday, August 23, 2011 1:30:36 PM UTC-4, AngeloC wrote: > Hi Ross, > > I'm looking into your user_agent_parser.py but I cannot find something > like the mobile detector. > > I'll explain better. With user_agent_parser.py you can look for > browser version and os version, but there isn't an easy way to dectect > if a browser is mobile or not, or I'm missing something? > > I think that a decorator for mobile versions or a global variable that > tells me a mobile browser wants mobile view is really necessary. > > I think it could be a really great and appreciated addition to the > framework! > > If you have somthing in mind, please share with us, I can contribute > to code and help testing. > > Thank you! > > 2011/8/18 Ross Peoples <ross.p...@gmail.com>: > > We already have a user_agent_parser.py in contrib. Isn't that the same > > thing? > > Usage: > > import contrib.user_agent_parser > > user_agent_parser.simple_detect(request.env.http_user_agent) > > By the way, didn't you add something to the Google Issues page for the > > proposal saying you were getting an error from that? If so can you give > me > > the user agent string that caused it? I asked for it on the issue, but I > > figured you didn't have notifications turned on and never got the > message. > >