If possible, I would separate the roman numbers and the town name in the 
model:

db.define_table('town', Field('name', default='Portella Della Ginestra'), 
Field('roman', ...))

That would solve the line break problem and you could just refer to the 
town by id

El lunes, 15 de octubre de 2012 06:49:00 UTC-3, Manuele escribió:
>
>
>
> 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