try this

class MYVALIDATOR:
    def __call__(self,value):
          if not value: return (value,None):
          ret = IS_UPLOAD_FILENAME()(value)
          if ret[1]: return ret
          ret = IS_IMAGE()(value)
          return  ret

requires=MYVALIDATOR()


On Sep 15, 9:38 pm, weheh <[email protected]> wrote:
> Massimo, the real question is how to write a validator if a file or
> image upload field's value is optional? So it can be NULL or some
> other value that either conforms to filename conventions (in the case
> of IS_UPLOAD_FILENAME()) or image naming conventions (in the case of
> IS_IMAGE()). In both cases, if a file is supplied, I want to also
> validate the size of the file.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to