On Sun, Apr 11, 2010 at 16:31, mdipierro <[email protected]> wrote:

> I think the problem is is that request.vars.file is a cgi.FieldStorage
> object and it lacks a __zero__ method therefore it incorrectly
> evaluates to false even if the object is present. This is an error in
> the book.


Ah yes...
I've looked in Storage, but not at FieldStorage.
Thank you for your insight.


> Anyway, the actualy filename is now atumatically base16
> encoded in the web2py-assigned filename and it is used to
> automatically set the filename in the content-disposition.
>

Do you mean I can retrieve the original name from
 request.vars.file.filename ?

On Apr 11, 9:19 am, matclab <[email protected]> wrote:
> >   I've just tried the recipe from the book p197 : "Storing the
> > original filename", and I've stumbled upon the following strange
> > behavior :
> > The following piece of code doesn't work (never get inside the IF)
> >     if request.vars.file:
> >         print "In the IF"
> >         form.vars.file_filename = request.vars.file.filename
> >
> > whereas the following worked ok !
> >     if 'file' in request.vars:
> >         print "In the IF"
> >         form.vars.file_filename = request.vars.file.filename
>


-- 
To unsubscribe, reply using "remove me" as the subject.

Reply via email to