Hi,
I got a quite similar result by working on the validation at the form level:
if form1.process().accepted:
session.flash = 'File uploaded'
redirect(URL('check_xls_file', args=form1.vars.id, user_signature=
True))
elif form1.errors:
response.flash = 'File rejected'
And in the check_xls_file function:
# Check that a file with the same name has not been already posted.
t = db.t_xlsfile
xlsfilename = t.f_xlsfile.retrieve(t_xlsfile_row.f_xlsfile)[0]
if xlsfilename in [t.f_xlsfile.retrieve(row.f_xlsfile)[0] for row in db(
t.id < t_xlsfile_row.id).select(t.f_xlsfile)]:
session.flash = T('Sorry, you already posted a file with that name
: %s' % (xlsfilename,))
db.rollback()
redirect(URL('index'))
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.