web/views/idownloadable.py
changeset 4382 6fb02edd05da
parent 4252 6c4f109c2b03
child 5421 8167de96c523
equal deleted inserted replaced
4381:62a89969c8b3 4382:6fb02edd05da
    66     binary = True
    66     binary = True
    67     add_to_breadcrumbs = False
    67     add_to_breadcrumbs = False
    68 
    68 
    69     def set_request_content_type(self):
    69     def set_request_content_type(self):
    70         """overriden to set the correct filetype and filename"""
    70         """overriden to set the correct filetype and filename"""
    71         entity = self.complete_entity(0)
    71         entity = self.cw_rset.complete_entity(0, 0)
    72         encoding = entity.download_encoding()
    72         encoding = entity.download_encoding()
    73         if encoding in BINARY_ENCODINGS:
    73         if encoding in BINARY_ENCODINGS:
    74             contenttype = 'application/%s' % encoding
    74             contenttype = 'application/%s' % encoding
    75             encoding = None
    75             encoding = None
    76         else:
    76         else:
    78         self._cw.set_content_type(contenttype or self.content_type,
    78         self._cw.set_content_type(contenttype or self.content_type,
    79                                   filename=entity.download_file_name(),
    79                                   filename=entity.download_file_name(),
    80                                   encoding=encoding)
    80                                   encoding=encoding)
    81 
    81 
    82     def call(self):
    82     def call(self):
    83         self.w(self.complete_entity(0).download_data())
    83         self.w(self.cw_rset.complete_entity(0, 0).download_data())
    84 
    84 
    85 
    85 
    86 class DownloadLinkView(EntityView):
    86 class DownloadLinkView(EntityView):
    87     """view displaying a link to download the file"""
    87     """view displaying a link to download the file"""
    88     __regid__ = 'downloadlink'
    88     __regid__ = 'downloadlink'