diff --git a/VERSION b/VERSION index 57bfb912..7c6e584d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.00.0 (2012-08-03 09:01:00) dev +Version 2.00.0 (2012-08-03 09:02:35) dev diff --git a/gluon/sqlhtml.py b/gluon/sqlhtml.py index a126f9c4..c5f84b12 100644 --- a/gluon/sqlhtml.py +++ b/gluon/sqlhtml.py @@ -1243,14 +1243,19 @@ class SQLFORM(FORM): else: fields[fieldname] = '' self.vars[fieldname] = fields[fieldname] - if not f: continue - if hasattr(f, 'file'): + if not f: + continue + else: + f = os.path.join(current.request.folder, + os.path.normpath(f)) + source_file = open(f, 'rb') + original_filename = os.path.split(f)[1] + elif hasattr(f, 'file'): (source_file, original_filename) = (f.file, f.filename) elif isinstance(f, (str, unicode)): - f = os.path.join(current.request.folder, - os.path.normpath(f)) - source_file = open(f, 'rb') - original_filename = os.path.split(f)[1] + ### do not know why this happens, it should not + (source_file, original_filename) = \ + (cStringIO.StringIO(f), 'file.txt') newfilename = field.store(source_file, original_filename, field.uploadfolder) # this line is for backward compatibility only