Il giorno lunedì 15 ottobre 2012 11:09:59 UTC+2, Manuele ha scritto:
>
> Dear all, 
>
> [omissis]
>
> The problem is by-passed using the other field definition commented out 
> up above using the validator IS_IN_SET. 
>

I beg your pardon... this is the real (bad and ugly) way I bypassed the 
problem by now:

def ontest(form):
    
    exec('tmp = %s' % form.vars['municipio'])
    form.vars = tmp
    
    pass

def test():

    mset = db(source_table).select(source_table.municipio, 
orderby=source_table.municipio, distinct=True)
    
    field = Field('municipio', 
requires=IS_EMPTY_OR(IS_IN_SET([(rec.as_dict(), rec.municipio) for rec in 
set(mset)])))
    
    form = SQLFORM.factory(
        field
    )
    if form.accepts(request.post_vars, onvalidation=ontest, dbio=False):
        <do somethig...>

    return locals()
 

>
> I think this could be considered as a bug... I hope it could help. 
>
> Cheers 
>
>      Manuele 
>

-- 



Reply via email to