[web2py] Re: SQLFORM.factory requires explicit uploadfolder

2013-09-05 Thread Massimo Di Pierro
You can always define def UploadField(*a,**b): b['uploadfolder'] = request.folder return Field(*a,**b) db.define_table( UploadField(...)) I often define def HiddenField(*a,**b): b['readable'] = b['writable'] = False return Field(*a,**b) def ReadonlyField(*a,**b):

[web2py] Re: SQLFORM.factory requires explicit uploadfolder

2013-09-05 Thread Alan Etkin
> > We could use current.request.folder but we would have to couple the dal > code to current. that is something we avoided to far. > I don't think it is necessary to use current in dal just for this. I don't mind adding uploadfolder on each Field(...) call, I just was curious why it was neede

[web2py] Re: SQLFORM.factory requires explicit uploadfolder

2013-09-05 Thread Massimo Di Pierro
We could use current.request.folder but we would have to couple the dal code to current. that is something we avoided to far. On Thursday, 5 September 2013 11:31:36 UTC-5, Alan Etkin wrote: > > > In that case, how will you determine the absolute folder path? > > It seems there's no way, unless th

[web2py] Re: SQLFORM.factory requires explicit uploadfolder

2013-09-05 Thread Alan Etkin
> In that case, how will you determine the absolute folder path? It seems there's no way, unless the field class reads request.folder which will be not always available. -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from

[web2py] Re: SQLFORM.factory requires explicit uploadfolder

2013-09-04 Thread Anthony
I guess the Field class doesn't have knowledge of the filesystem. When Field() is used inside of define_table(), it figures out the folder location from db._adapter.folder, but there is no db._adapter when using Field() within SQLFORM.factory(). In that case, how will you determine the absolute

[web2py] Re: SQLFORM.factory requires explicit uploadfolder

2013-09-04 Thread Massimo Di Pierro
No objection. On Wednesday, 4 September 2013 16:27:35 UTC-5, Alan Etkin wrote: > > Is this bug or feature? > > def myaction(): > form = SQLFORM.factory(Field("myupload", "upload")) > if form.process().accepted: > print form.vars > return dict(form=form) > > On submission it pro