yes but

elif field.type == 'upload':
                f = self.vars[fieldname]
                fd = '%s__delete' % fieldname
                if f == '' or f is None:
                    ...
                    continue

so if the user does not upload a file, the continue statement should 
prevent web2py from execute the line where you get the error. Try add a 
print f immediately after f=self.vars[fieldname].

On Thursday, 26 July 2012 01:19:07 UTC-5, Annet wrote:
>
> Massimo,
>
> It would help if you could help debug as suggested below.
>
>
> As mentioned in issue 906, I did add a print statement at line 1206:
>
> elif field.type == 'upload':
>                 f = self.vars[fieldname]
>                 fd = '%s__delete' % fieldname
>                ...
>                 print f
>                 newfilename = field.store(source_file, original_filename, 
> field.uploadfolder)
>
> ..., however, nothing was written to the shell when I submitted a form 
> with the field of type upload left empty. I just got the same error?
> If adding print f  and submitting the form, isn't the correct way to 
> debug, please let me know.
>
>
>  How it is possible that source_file is None?
>
> In table Person the field of type upload is optional, the error occurs 
> when the user doesn't upload a file.
>
>
> What is the value of the variable f when this happens?
>
> I don't know, the default of an empty upload field in web2py?
>
>
> It should accept any character in the original filename. If it does not, 
> where does it fail?
>
> After restarting web2py, this no longer fails.
>
>
> Kind regards,
>
> Annet
>

-- 



Reply via email to