You just proved I was wrong. My memory failed me. This is good. This means the current trunk is ok. :-)
Massimo On Sunday, 10 March 2013 20:04:25 UTC-5, Alex wrote: > > I have to disagree, unless we're talking about something different... this > was definitely standard behavior until recently. > I have two older web2py versions which both return a stream. I'm talking > about the retrieve method in dal.py, maybe you mean something different? > > web2py 1.99.2: > # ## if file is on filesystem > if path: > pass > elif self.uploadfolder: > path = self.uploadfolder > else: > path = os.path.join(self.db._adapter.folder, '..', > 'uploads') > if self.uploadseparate: > t = m.group('table') > f = m.group('field') > u = m.group('uuidkey') > path = os.path.join(path,"%s.%s" % (t,f),u[:2]) > return (filename, open(os.path.join(path, name), 'rb')) > > > web2py 2.1.1: > else: > # ## if file is on regular filesystem > stream = open(pjoin(file_properties['path'], name), 'rb') > return (filename, stream) > > > in both versions a stream is returned for a file on the filesystem. > > On Monday, March 11, 2013 1:35:51 AM UTC+1, Massimo Di Pierro wrote: >> >> No. For uploads stored on filesystem it always returned (filename, >> fullfilename). For other types of uploads it returned (filename, stream). >> >> We tried to change this and return always consistently (filename, >> stream). There was only one trunk version that did that. It was reverted >> because of caching concerns. The current trunk version is another >> experiment. These are tests. This is not the standard behavior. I am glad >> it now works as you expect but it not decided it is going to stay this way >> until we clear all issues. >> >> >> >> On Sunday, 10 March 2013 18:25:02 UTC-5, Alex wrote: >>> >>> I guess you meant to say it always returned a stream instead of the file >>> name in your reply above (and not the other way around)? >>> >>> I just saw your recent commit and it works fine again, the retrieve >>> method now returns a stream as excepted. thanks! >>> >>> Am Sonntag, 10. März 2013 23:40:39 UTC+1 schrieb Massimo Di Pierro: >>>> >>>> Can you check is the current trunk works for you? We are trying to >>>> improve the APIs of retrieve. >>>> >>>> On Sunday, 10 March 2013 13:58:23 UTC-5, Alex wrote: >>>>> >>>>> I'm currently using web2py 2.1.1 and wanted to try 2.4.2 but I got a >>>>> problem with retrieving uploaded files from the file system. I'm using >>>>> the >>>>> retrieve method of the upload field. >>>>> The problem is in dal.py line 9265 where it returns the file path >>>>> instead of the stream. >>>>> stream = pjoin(file_properties['path'], name) >>>>> previously this was >>>>> stream = open(pjoin(file_properties['path'], name), 'rb') >>>>> >>>>> now my code does not work anymore. I assume the missing open call is a >>>>> bug, right? >>>>> >>>>> Alex >>>>> >>>>> -- --- 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/groups/opt_out.