| Home | Trees | Indices | Help |
|
|---|
|
|
object --+
|
Validator --+
|
IS_UPLOAD_FILENAME
Checks if name and extension of file uploaded through file input matches
given criteria.
Does *not* ensure the file type in any way. Returns validation failure
if no data was uploaded.
Arguments::
filename: filename (before dot) regex
extension: extension (after dot) regex
lastdot: which dot should be used as a filename / extension separator:
True means last dot, eg. file.png -> file / png
False means first dot, eg. file.tar.gz -> file / tar.gz
case: 0 - keep the case, 1 - transform the string into lowercase (default),
2 - transform the string into uppercase
If there is no dot present, extension checks will be done against empty
string and filename checks against whole value.
Examples::
#Check if file has a pdf extension (case insensitive):
INPUT(_type='file', _name='name',
requires=IS_UPLOAD_FILENAME(extension='pdf'))
#Check if file has a tar.gz extension and name starting with backup:
INPUT(_type='file', _name='name',
requires=IS_UPLOAD_FILENAME(filename='backup.*',
extension='tar.gz', lastdot=False))
#Check if file has no extension and name matching README
#(case sensitive):
INPUT(_type='file', _name='name',
requires=IS_UPLOAD_FILENAME(filename='^README$',
extension='^$', case=0))
|
|||
|
|||
|
|||
|
Inherited from Inherited from |
|||
|
|||
|
Inherited from |
|||
|
|||
x.__init__(...) initializes x; see help(type(x)) for signature
|
|
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Mon Oct 14 15:17:07 2013 | http://epydoc.sourceforge.net |