add PicklableUpload get_content method (#7258)

This commit is contained in:
Thomas NOËL 2015-05-19 08:57:45 +02:00
parent 2255337a50
commit 4f7f35af31
1 changed files with 6 additions and 0 deletions

View File

@ -687,6 +687,12 @@ class PicklableUpload(Upload):
# quack like UploadedFile
return self.get_file_pointer()
def get_content(self):
if hasattr(self, 'qfilename'):
filename = os.path.join(get_publisher().app_dir, 'uploads', self.qfilename)
return file(filename).read()
return None
class EmailWidget(StringWidget):
HTML_TYPE = 'email'