A ticket about upload fields ignoring dbio=False or the SQLFORM.factory
feature?
Em terça-feira, 27 de novembro de 2012 14h18min44s UTC-2, Massimo Di Pierro
escreveu:
>
> At this time the API do not allow this but perhaps it should. Please open
> a ticket about this.
>
>
> On Tuesday, 27 November 2012 05:29:03 UTC-6, Fabiano Faver wrote:
>>
>> in web2py book:
>> In the case of a table including an "upload"-type field ("fieldname"),both
>> process(dbio=False) and validate() deal with the storage of the uploaded
>> file as if process(dbio=True), the default behavior.
>>
>> it means that I cannot delay the upload?
>>
>> model based on Massimo examples:
>>
>> db.define_table('allfiles',
>> Field('filename', readable=False, writable=False),
>> Field('filepath', readable=False, writable=False),
>> Field('parentpath', readable=False, writable=False),
>> Field('filetype', readable=False, writable=False),
>> Field('file','upload',uploadfolder=os.path.normpath(r'c:\caminho'),
>> label='arquivos'),
>> Field('content','text', readable=False, writable=False),
>> Field('datecreated','datetime',default=now, readable=False,
>> writable=False),
>> Field('datemodified','datetime',default=now, readable=False,
>> writable=False),
>> Field('filesize','integer', readable=False, writable=False),
>> Field('user',db.auth_user,default=me, readable=False, writable=False))
>>
>> Using this with SQLFORM and only showing the upload field.
>>
>> After validate() I validate some inputs and then insert in db. but its
>> creating two files in file system. One its from my insert and other that
>> ignores dbio=False when processing the form.
>>
>> What am I missing?
>>
>> Its possible to use a sqlform.factory with only a upload field that can
>> use validators and file system names used by this model?
>>
>
--