[web2py] Re: Manual file insertion into uploads folder

2013-08-07 Thread SimonD
Anthony, I had thought that the actual content of the stream was used in the hash. But, reading your response, it seems that's not the case (and in fact why would it). I will endevour to perhaps write the header record in the csv, then insert into the upload table, and then write the bulk of the

[web2py] Re: Manual file insertion into uploads folder

2013-08-07 Thread Niphlod
you can pass a StringIO instance instead of the open(filename, 'rb') To avoid the double-pass just create the csv as a StringIO stream and insert it directly into the table with the db.tablename.field.store() as the example you posted: web2py will save the file into the uploads/ folder and

[web2py] Re: Manual file insertion into uploads folder

2013-08-07 Thread Anthony
Do you have to store the file before inserting the db record? Or can you create the CSV file object and do the insert in the same action? If not, here's the code for creating an uploaded filename: https://code.google.com/p/web2py/source/browse/gluon/dal.py#9387. The filename is of the form: ta