Hi everyone,
I've just realized what I was doing wrong.

What happened is that I was not returning locals(), but a custom dict,
which was not updated.

Right implementation:

def index():
    datalayer = get_datalayer('general','index')
    return locals()

Wrong implementation:

def index():
    datalayer = get_datalayer('general','index')
    return dict(message=T('Welcome to my app!'))


Thanks! Jon.


On Wed, Apr 1, 2020 at 5:59 PM Jon Subscripted <jonsubscripti...@gmail.com>
wrote:

> Hi everyone,
> I'm trying to include view specific data in each view header (it is
> actually a GTM datalayer).
>
> I thought the best way to do it was to define a global variable in db.py
> and to print a variable  {{=datalayer}}, the each controller will overwrite
> it with specific data.
>
> It seems to be working for most of my views, except:
> -index.html
> -all user.html views (login/register/profile/change_password/etc.)
>
> Any suggestions on how to make it work on index.html and user.html?
> What am I doing wrong?
> Thanks in advance, Jon.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CAK8tz30a%3Dp47eMR_CXt1q0XN5Exfp_vTb5VV0mO2mu3d0ZVRsQ%40mail.gmail.com.

Reply via email to