You opened a pyfpdf issue. You may want to close it.

I moved it to web2py issue 1010 and I think I have a fix in trunk. Can you 
check?

http://code.google.com/p/web2py/issues/detail?id=1010

On Sunday, 16 September 2012 01:03:19 UTC-5, mweissen wrote:
>
> Done: Issue 29 <https://code.google.com/p/pyfpdf/issues/detail?id=29>: on 
> error IS_LIST_OF() changes the value of INPUT 
>
> 2012/9/16 Massimo Di Pierro <massimo....@gmail.com <javascript:>>
>
>> Definitively a problem with the widget. Please open a ticket about it.
>>
>>
>> On Saturday, 15 September 2012 17:01:44 UTC-5, mweissen wrote:
>>
>>> Sorry, I did not mention: 
>>> I did not use a form, I have used the admin interface to insert and 
>>> update the records.
>>> I have tried it twice: first with my "real" program and second with the 
>>> small program I have sent.
>>>
>>> Now I have added this function:
>>>
>>> def em():
>>>     form=SQLFORM(db.address)
>>>     if form.process().accepted:
>>>         response.flash='ok'
>>>     elif form.errors:
>>>         print form.errors
>>>     return dict(form=form)    
>>>
>>> ... and used it to add two wrong email-addresses:
>>> aa
>>> bb
>>>
>>> I did not get an error messege below the fields, but the flash "Errors 
>>> in form, please check it out" and both fileds look like 
>>> ['aa', 'bb']
>>>
>>>
>>> 2012/9/15 Massimo Di Pierro <massimo....@gmail.com>
>>>
>>>> I cannot reproduce this:
>>>>
>>>> >>> IS_EMAIL()('x')
>>>> ('x', 'enter a valid email address')
>>>> >>> IS_EMAIL()('x...@x.com')
>>>> ('x...@x.com', None)
>>>> >>> IS_LIST_OF(IS_EMAIL())(['x'])
>>>> (['x'], 'enter a valid email address')
>>>> >>> IS_LIST_OF(IS_EMAIL())(['x...@x.**com'])
>>>> (['x...@x.com'], None)
>>>> >>> IS_LIST_OF(IS_EMAIL())(['x#x.**com <http://x.com>'])
>>>> (['x#x.com'], 'enter a valid email address')
>>>>
>>>> can your print form.errors? Perhaps this is a problem with the widget 
>>>> and not the validator.
>>>>
>>>> On Saturday, 15 September 2012 13:08:50 UTC-5, mweissen wrote:
>>>>
>>>>> I have a simple table, one name and a list of email-addresses:
>>>>>
>>>>> db.define_table('address',
>>>>>     Field('name'),
>>>>>     Field('emails','list:string', requires=IS_LIST_OF(IS_EMAIL()****
>>>>> )))
>>>>>
>>>>> Now I add one name and two email-addresses to this table.
>>>>>
>>>>> Id:      1
>>>>> Name:    Smith
>>>>> Emails:  jsm...@example.com
>>>>>          j...@example.com
>>>>>
>>>>> Everything looks fine.
>>>>>
>>>>> But if there is an error in the email-address (which is catched by the 
>>>>> validator), a lot goes wrong:
>>>>> Both email-addresses are converted to a list; this list is doubled and 
>>>>> ...
>>>>>
>>>>> Id:      1
>>>>> Name:    Smith
>>>>> Emails:  ['jsmith*#*example.com', 'j...@example.com']
>>>>>          ['jsmith#example.com', 'j...@example.com']
>>>>>
>>>>> ... there is no error message!
>>>>>
>>>>> Now I have changed the model to
>>>>>
>>>>> db.define_table('address',
>>>>>     Field('name'),
>>>>>     Field('emails','list:string', requires=IS_EMAIL()))
>>>>>
>>>>> but this model does not detect the wrong email address.
>>>>>
>>>>> What is the right way to use a validator with a list of strings?
>>>>>
>>>>> Regards, Martin
>>>>>
>>>>
>>>>  

-- 



Reply via email to