changed retrieve again

This commit is contained in:
mdipierro
2013-03-10 17:40:36 -05:00
parent a57919bc4d
commit 9767109d4e
3 changed files with 11 additions and 4 deletions
+1 -1
View File
@@ -1 +1 @@
Version 2.4.2-stable+timestamp.2013.03.10.17.08.00
Version 2.4.2-stable+timestamp.2013.03.10.17.39.45
+9 -2
View File
@@ -9235,7 +9235,11 @@ class Field(Expression):
dest_file.close()
return newfilename
def retrieve(self, name, path=None):
def retrieve(self, name, path=None, nameonly=False):
"""
if nameonly==True return (filename, fullfilename) instead of
(filename, stream)
"""
self_uploadfield = self.uploadfield
if self.custom_retrieve:
return self.custom_retrieve(name, path)
@@ -9265,7 +9269,10 @@ class Field(Expression):
# ## if file is on regular filesystem
# this is intentially a sting with filename and not a stream
# this propagates and allows stream_file_or_304_or_206 to be called
stream = pjoin(file_properties['path'], name)
fullname = pjoin(file_properties['path'],name)
if nameonly:
return (filename, stream)
stream = open(fullname,'rb')
return (filename, stream)
def retrieve_file_properties(self, name, path=None):
+1 -1
View File
@@ -404,7 +404,7 @@ class Response(Storage):
except AttributeError:
raise HTTP(404)
try:
(filename, stream) = field.retrieve(name)
(filename, stream) = field.retrieve(name,nameonly=True)
except IOError:
raise HTTP(404)
headers = self.headers