I applied the follwing validators for upload fields in version 1.91.6: requires = [ IS_NULL_OR(IS_UPLOAD_FILENAME(extension='pdf')), IS_NULL_OR(IS_LENGTH(1048576, 1024)), ]
Everything was fine until I used a SQLFORM object with an upload keyword for editing. Then, a delete checkbox of an upload widget falsely disappeared which should be displayed with a link to the uploaded file. This is the result of the code in UploadWidget class of gluon/ sqlhtml.py: if requires == [] or isinstance(requires, IS_EMPTY_OR): inp = DIV(, ..., UploadWidget.ID_DELETE_SUFFIX), ...) And, the next patch would tentatively fix the problem: if (requires == [] or isinstance(requires, IS_EMPTY_OR) or (isinstance(requires, (list, tuple)) and reduce(lambda a,b:a&b, [isinstance(r, IS_EMPTY_OR) for r in requires]))): ... But, I am not sure if the above patch is smart. Is there any way to implement such validation without patches nor custom validators?