Hi,
When I use SQLFORM.factory with an 'upload' field, I get the following
error:
(error)
RuntimeError: you must specify a Field(...,uploadfolder=...)
(traceback)
Traceback (most recent call last):
File "C:\web2py\gluon\restricted.py", line 188, in restricted
exec ccode in environment
File "C:/web2py/applications/test/controllers/default.py", line 68, in
<module>
File "C:\web2py\gluon\globals.py", line 95, in <lambda>
self._caller = lambda f: f()
File "C:/web2py/applications/test/controllers/default.py", line 60, in
test
if form.accepts(request, session): response.flash = 'saved'
File "C:\web2py\gluon\sqlhtml.py", line 1131, in accepts
newfilename = field.store(source_file, original_filename)
File "C:\web2py\gluon\dal.py", line 4359, in store
raise RuntimeError, "you must specify a Field(...,uploadfolder=...)"
RuntimeError: you must specify a Field(...,uploadfolder=...)
(test model)
db.define_table('test', Field('text'), Field('image','upload'))
(test controller)
def test():
form = SQLFORM.factory(db.test)
if form.accepts(request, session): response.flash = 'saved'
elif form.errors: response.flash = 'errors'
else: pass
return dict(form=form)
On the other hand, if I use SQLFORM directly (without factory), everything
works ok.
Is this a bug or the expected behavior?.
Thanks,
Carlos