Re: [web2py] extract file from blob/bytea to store it on file system

2014-05-05 Thread Richard Vézina
Not elegant, but finally works : rows = db().select(db.mytable.id, db.mytable.upload_field, db.mytable.upload_field_blob) for i, row in enumerate(rows): if row.upload_field != '' and row.upload_field is not None: file = cStringIO.StringIO() file.write(row.upload_field_blob)

Re: [web2py] extract file from blob/bytea to store it on file system

2014-05-04 Thread Richard Vézina
In [16]: db.mytable.fieldname_field.retrieve(row.fieldname_field, nameonly=True)[1] Out[16]: In [17]: db.mytable.fieldname_field.retrieve(row.fieldname_field)[1] Out[17]: Idem :( Richard On Sun, May 4, 2014 at 3:49 PM, Richard Vézina wrote: > I saw the StringIO content of the blob. I had wr

Re: [web2py] extract file from blob/bytea to store it on file system

2014-05-04 Thread Richard Vézina
I saw the StringIO content of the blob. I had write a file manually with that blob content... I may have not look carefully... I will have another look. Richard On Sun, May 4, 2014 at 2:51 PM, Niphlod wrote: > not sure what you want to accomplish but > > > http://web2py.readthedocs.org

Re: [web2py] extract file from blob/bytea to store it on file system

2014-05-04 Thread Niphlod
not sure what you want to accomplish but http://web2py.readthedocs.org/en/latest/dal.html#gluon.dal.DAL.Field.retrieve you're using nameonly, that explicitely doesn't return any content. On Sunday, May 4, 2014 7:58:03 PM UTC+2, Richard wrote: > > Hello, > > I try to extract file from upl

[web2py] extract file from blob/bytea to store it on file system

2014-05-04 Thread Richard
Hello, I try to extract file from upload field of type blob to store my files on file system instead. I get there so far : rows = db().select(db.mytable.id, db.mytable.filename_field, db.mytable.blob_field) for i, row in enumerate(rows): if row.filename_field != '' and row.filename_field i