it worked. Thank you very much.

On Dec 23, 12:15 am, mdipierro <[email protected]> wrote:
> The problem is thet you have an upload field is a form that is not
> connected to a database (because you are using a factory). web2py does
> not know what to do with the file. You need to specify the
> uploadfolder.
>
> uf=os.path.join(request.folder,'uploads')
> form =
> SQLFORM.factory(Field('email','string'),Field('data','upload',uploadfolder= 
> uf))
>
> Massimo
>
> On Dec 22, 4:49 pm, Charis <[email protected]> wrote:
>
>
>
>
>
>
>
> > I define the db using:
>
> > db = DAL('sqlite://db.db')
>
> > db.define_table('database',
> >                 SQLField('email','string'),
> >                 SQLField('data','upload')
> >                 )
>
> > I create a form using
>
> > form = SQLFORM.factory(db.database.email,db.database.data)
>
> > The form appears correctly but when i try to submit a file i get the
> > following error: (the problem seems to be in dal.py at line 4141 where
> > path == '' or path.endswith('/') )
>
> > File /home/charis/Desktop/test/gluon/dal.py in store at line 4141
> >             if path:
> >                 pass
> >             elif self.uploadfolder:
> >                 path = self.uploadfolder
> >             else:
> >                 path = os.path.join(self.db._adapter.folder, '..',
> > 'uploads')
>
> >             if self.uploadseparate:
> >                 path = os.path.join(path,"%s.%s" % (self._tablename,
> > self.name),uuid_key[:2])
> >             if not os.path.exists(path):
> >                 os.makedirs(path)
>
> > File /usr/lib/python2.6/posixpath.py in join at line 67
> >     will be discarded."""
> >     path = a
> >     for b in p:
> >         if b.startswith('/'):
> >             path = b
> >         elif path == '' or path.endswith('/'):
>
> >             path +=  b
> >         else:
> >             path += '/' + b
> >     return path
>
> > On Dec 20, 2:03 am, mdipierro <[email protected]> wrote:
>
> > > I cannot reproduce the problem. What db?
>
> > > On Dec 19, 6:39 pm, Charis <[email protected]> wrote:
>
> > > > I have the following error message when i try to upload a file in
> > > > web2py 1.90.4. This feature was working fine for me with the previews
> > > > versions.
>
> > > > Traceback (most recent call last):
> > > >   File "/home/charis/Desktop/Dropbox/BioSP_v0.6/gluon/restricted.py",
> > > > line 188, in restricted
> > > >     exec ccode in environment
> > > >   File "/home/charis/Desktop/Dropbox/BioSP_v0.6/applications/init/
> > > > controllers/default.py", line 150, in <module>
> > > >   File "/home/charis/Desktop/Dropbox/BioSP_v0.6/gluon/globals.py",
> > > > line 95, in <lambda>
> > > >     self._caller = lambda f: f()
> > > >   File "/home/charis/Desktop/Dropbox/BioSP_v0.6/applications/init/
> > > > controllers/default.py", line 15, in index
> > > >     if form.accepts(request.vars, session):
> > > >   File "/home/charis/Desktop/Dropbox/BioSP_v0.6/gluon/sqlhtml.py",
> > > > line 1104, in accepts
> > > >     newfilename = field.store(source_file, original_filename)
> > > >   File "/home/charis/Desktop/Dropbox/BioSP_v0.6/gluon/dal.py", line
> > > > 4132, in store
> > > >     path = os.path.join(self.db._adapter.folder, '..', 'uploads')
> > > >   File "/usr/lib/python2.6/posixpath.py", line 67, in join
> > > >     elif path == '' or path.endswith('/'):
> > > > AttributeError: 'NoneType' object has no attribute 'endswith'

Reply via email to