Re: [web2py] how to cleanse field value

2012-12-22 Thread wwwgong
Thank you! On Wednesday, December 19, 2012 7:04:03 PM UTC-5, Massimo Di Pierro wrote: > > Here is a custom validator that replaces '-' with '_' > > class MyValidator(obejct): > def __call__(self,value): > return (value.replace('-','_'), None) > > Field(..., requires=MyValidator()...)

Re: [web2py] how to cleanse field value

2012-12-19 Thread Massimo Di Pierro
Here is a custom validator that replaces '-' with '_' class MyValidator(obejct): def __call__(self,value): return (value.replace('-','_'), None) Field(..., requires=MyValidator()...) On Wednesday, 19 December 2012 16:54:21 UTC-6, wwwgong wrote: > > I thought validator only validates

Re: [web2py] how to cleanse field value

2012-12-19 Thread wwwgong
I thought validator only validates, can you show me how to update field with the sanitized value. Thanks, On Wednesday, December 19, 2012 9:57:48 AM UTC-5, viniciusban wrote: > > Try a custom validator to sanitize your description field. > > > On Wed, Dec 19, 2012 at 12:06 PM, wwwgong > > wrote

Re: [web2py] how to cleanse field value

2012-12-19 Thread Vinicius Assef
Try a custom validator to sanitize your description field. On Wed, Dec 19, 2012 at 12:06 PM, wwwgong wrote: > Hi, > I like to store youtube videos into a table: > > db.define_table('youtube', > Field('code'), > Field('description') > ) > > def youtube_repr(code,width=400,height=250):

[web2py] how to cleanse field value

2012-12-19 Thread wwwgong
Hi, I like to store youtube videos into a table: db.define_table('youtube', Field('code'), Field('description') ) def youtube_repr(code,width=400,height=250): return XML(""" http://www.youtube.com/v/%(code)s&hl=en_US&fs=1&"> http:/