This may be a bug. I will investigate today. If you know python can
help us.
In sqlhtml:

                if f == '' or f == None:
                    if self.vars.get(fd, False) or not self.record:
                        fields[fieldname] = ''
                    else:
                        fields[fieldname] = self.record[fieldname]
                    continue
                elif hasattr(f,'file'):
                    (source_file, original_filename) = (f.file,
f.filename)
                elif isinstance(f, (str, unicode)):
                    ### 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)

the if...elif....elif should cover all options but it seems it does
not add this line before the last

print type(f)

what does it print?


On Apr 13, 6:06 am, npsads <[email protected]> wrote:
> Hi
> I'm web2py newbie.
> Can anybody show me example how to use jquery.multifile in web2py ?
> This is my code:
> def add():
>     form=SQLFORM.factory(
>         Field('description'),
>         Field('atachment','upload',label='Załączniki'))
>
>     if form.accepts(request.vars, session):
>         response.flash = 'Ok'
>     elif form.errors:
>         response.flash = 'Error'
>     else:
>         response.flash = 'Input'
>     return dict(form=form)
>
> jguery.mulitfile is set  for class "upload" . Every time when i try to
> send form with more then 1 atachment i got error
>
>  File "C:\Documents and Settings\wisnia\Pulpit\W2P\gluon\sqlhtml.py",
> line 947, in accepts
>     newfilename = field.store(source_file, original_filename)
> UnboundLocalError: local variable 'source_file' referenced before
> assignment
>
> Thanks
> Rafal


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

Reply via email to