You can do form = SQLFORM(db.artwork, request.args[0], fields=fields, upload=URL(r=request, c='gae', f='preview'),_action=....)
On May 3, 4:11 pm, howesc <how...@umich.edu> wrote: > Hello, > > Is it intentional that when using SQLFORM, and custom views (with > form.custom.begin), that if i modify attributes after initial form > construction I have to update form.custom.begin myself? > > here's my example: > > form = SQLFORM(db.artwork, request.args[0], fields=fields, > upload=URL(r=request, c='gae', f='preview')) > > if request.env.web2py_runtime_gae: > from google.appengine.ext import blobstore > upload_url = > blobstore.create_upload_url(URL(r=request,f='upload_art', > args=request.args, > > vars={'redir':URL(r=request,c='account', f='index')})) > > form['_action']=upload_url > (begin, end) = form._xml() > form.custom.begin = XML("<%s %s>" % (form.tag, begin)) > > note that if i don't update form.custom.begin myself it does not > include the '_action' attribute. In most cases you just initialize > the form with all the needed attributes, but in this case if i'm on > google app engine i need the upload field to post to another URL > (since i'm using blobstore), but if i'm not on GAE i can use the > regular action. > > I suppose at this point the app only runs on GAE, so i can just skip > the if statement, but thought this might be a low-priority bug. > > thanks, > > christian