I think we can make this much easier to do. Hopefully next version. Massimo
On Apr 26, 12:59 am, Iceberg <iceb...@21cn.com> wrote: > Hi pals, > > I've read "About file upload and renaming" > here:http://mdp.cti.depaul.edu/AlterEgo/default/show/50 > > I think it is somewhat hard to remember we should do: > form.vars.filename=do_something(request.vars.file.filename) > > rather than: > request.vars.filename=do_something(request.vars.file.filename) # I > tried, it does not work > > So I suggest to use another less-ambiguous way, based on the > onvalidation callback. > > In controllers: > def test(): > form=SQLFORM(...) > def validate(form): > # There is no way here you would mistakenly try to use > request.vars > form.vars.filename=form.vars.file.filename > if form.accepts(request.vars,session,onvalidation=lambda f:validate > (f)): > response.flash='ok' > return {'':form} > > PS: I've post a comment on that AlterEgo link too, waiting for > approval. > > Sincerely, > Iceberg, 2009-Apr-26, 13:51(PM), Sun --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---