[Flask] Can I write my own WTF file validator?

Tiger Nassau tigernassau at gmail.com
Mon Oct 19 16:46:02 CEST 2015


you must be a windows person (: this is open source and you can do anything you want to your app - just try out your idea and test - its only form stuff so should not break too much of the app if it does not work   post any specific errors and others can help more 

if you get it working and think it will benefit others then post a blog and submit the code via a pull request 

Sent from Type Mail



On Oct 19, 2015, 07:02, at 07:02, Jim Icenhower via Flask <flask at python.org> wrote:
>Hi,I'm creating an import using Flask, WTF and Flask Appbuilder. I see
>that the Flask WTF FileField allows validators. Can I create my own? I
>want to check that required fields are populated on every record in the
>uploaded file. I'd like to pass a class to the validator that contains
>the required fields so I can use this routine for many different record
>types.I think I'd like to do something like this:class
>UploadForm(Form):
>    upload = FileField("Upload your Events file",
>                       validators=[file_required(),
>file_required_fields(Events, "Images only!")])Is this possible? If so,
>what class to I extend/inherit from to create my validator? I'm a Java
>developer but a total newbie to Python/Flask.
>Thanks!
>Jim
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Flask mailing list
>Flask at python.org
>https://mail.python.org/mailman/listinfo/flask
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/flask/attachments/20151019/a896e1f5/attachment.html>


More information about the Flask mailing list