Please show your code and the exception.

On Wednesday, July 16, 2014 4:15:27 PM UTC-4, Louis Amon wrote:
>
> I'm a great fan of LOAD, and i'm using it quite a bit to generate cool 
> ajax pages.
>
> I got one issue so far though : can't seem to *cleanly* detect a mobile 
> device in a .load view.
>
> For example I have a "result.load" view and I want a special mobile 
> display in "result.mobile.load".
>
> I've tried to use the decorator @mobilize but it seems that user_agent() 
> raises an Exception when called from a LOADed view.
>
> Is there a clean way to do that ?
>
>
> For those who, like me, are struggling over this, there is a monkeypatch :
>
> In the controller/view that calls LOAD(...):
> LOAD(..., vars=dict(is_mobile=request.user_agent().is_mobile))
>
> In the LOADed view:
> is_mobile = (request.vars.is_mobile == 'True')
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to