import gluon

should be

from gluon import *

On Wednesday, 3 April 2013 16:06:24 UTC-5, Ivan Gazzola wrote:
>
> I wrote this module my_util.py:
>
> #!/usr/bin/env python
> # coding: utf8
>
> import gluon
>
> def my_form(form, fields): 
>     table = TAG['']() 
>     for id, label, controls, help in fields:
>         lab1=str(label)
>         tmp_label=lab1.partition('>')
>         lab1=tmp_label[0]+tmp_label[1]+'<b>'+tmp_label[2]
>         tmp_label=lab1.partition('</')
>         _label=tmp_label[0]+'</b>'+tmp_label[1]+tmp_label[2]
>         if string.find(str(controls),'legend')>0:
>             table.append(controls) 
>         else:
>             table.append(DIV(XML(_label),'\n', controls,'\n', help,**{
> '_data-role':'fieldcontain','_id':id})+'\n')
>     return table
>     pass
>
> If i put the function my_form in controllers it works well.
> But when i try to do:
>
> from my_util import my_form
>
>
>
> def testi_consensi():
>     response.menu=[]
>     form = SQLFORM(db.mytable, separator='',showid = False,\
>                      formstyle=lambda form, fields: form_mia(form, fields
> ), submit_button = 'Nuovo Testo',)
>     return dict(form=form)
>
>
> i've this error:
>
> <type 'exceptions.NameError'> global name 'TAG' is not defined
>
>
>

-- 

--- 
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