Hey is working now !!!
maybe was the browser cache, i don't know...i've restarted all and now is 
working!

Anyway a reply to my original questions will be appreciated. (Still need to 
know theright way to do it)



Il giorno venerdì 17 gennaio 2014 09:38:32 UTC+1, ccadmin ha scritto:
>
> Hi
>
> i'm triyng to override a function inside gluon/tools.py
>
> i've created a model named 0.py with this code
> def myaddrow(form, a, b, c, style, _id, position=-1):
>     if style == "divs":
>         form[0].insert(position, DIV(DIV(LABEL(a), _class='someclass'),
>                                      DIV(b, _class='someclass'),
>                                      DIV(c, _class='someclass'),
>                                      _id=_id))
>     elif style == "table2cols":
>         form[0].insert(position, TR(TD(LABEL(a), _class='someclass'),
>                                     TD(c, _class='someclass')))
>         form[0].insert(position + 1, TR(TD(b, _class='someclass'),
>                                         _colspan=2, _id=_id))
>     elif style == "ul":
>         form[0].insert(position, LI(DIV(LABEL(a), _class='someclass'),
>                                     DIV(b, _class='someclass'),
>                                     DIV(c, _class='someclass'),
>                                     _id=_id))
>     elif style == "bootstrap":
>         form[0].insert(position, DIV(LABEL(a, _class='someclass'),
>                                      DIV(b, SPAN(c, _class='someclass'),
>                                          _class='someclass'),
>                                      _class='someclass', _id=_id))
>     else:
>         form[0].insert(position, TR(TD(LABEL(a), _class='someclass'),
>                                     TD(b, _class='someclass'),
>                                     TD(c, _class='someclass'), _id=_id))
>
> from gluon import tools
>
> tools.addrow = myaddrow
>
> If i print tools.__dict__ i can see that the function is the right one
> ... 'addrow': <function myaddrow at 0x05C55770> ...
> but no effect on final render of the page (the classes are still w2p_fw, 
> w2p_fc, etc...)
>
> what i'm doing wrong?
>
> Can someone please post:
> 1. how to override a function inside a gluon module (not in a class)
> 2. how to override a function inside a class of gluon (in a class) the A() 
> TAG for example
> 3. how this pratice will affect performance?
>
> sorry but i'm learning python alongside web2py so i'm not an expert in this
>
> Thanks in advance.
>

-- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to