Hi All, I'm having a very very weird problem with some upload processing I'm performing in web2py. Firstly for context here is the code I am using:
Controller: def validate_test(): form = SQLFORM.factory( Field('csvfile', 'upload'), table_name="dataset_upload") if form.validate(): logger.info("form validating") candidate_file = request.vars.csvfile.file.read() logger.info("{}".format(candidate_file)) elif form.process().accepted: response.flash = 'form accepted' elif form.errors: response.flash = 'form has errors' return dict(form=form) And the View: {{extend 'layout.html'}} <div style="background: linear-gradient(240deg, lightgrey, whitesmoke)" class="jumbotron"> <br><br> {{=form}} </div> This is essentially as simple as it can be. The user should upload a csv file, and I wish to run a suite of validators on that csv file before returning to the user whether the validation was passed or where it failed and on what. Now this is the first step, just checking that the form csv is readable by the server. And here is where I hit the problem: Sometimes I get out (as expected) the contents of the csv file from logger. info("{}".format(candidate_file)) Most of the time I just get out a blank string, even with the same input file! I feel like I'm going mad, doing the same thing twice and getting different results. It smells to me like caching or race conditions but I just have no idea what really is going on or why this might be happening. Do you have any ideas? Thanks! -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.