web/views/idownloadable.py
changeset 3460 e4843535db25
parent 3451 6b46d73823f5
child 3890 d7a270f50f54
equal deleted inserted replaced
3459:e134d2dd9992 3460:e4843535db25
    24     if not (mt and mt.startswith('image/')):
    24     if not (mt and mt.startswith('image/')):
    25         return 0
    25         return 0
    26     return 1
    26     return 1
    27 
    27 
    28 def download_box(w, entity, title=None, label=None):
    28 def download_box(w, entity, title=None, label=None):
    29     req = entity.req
    29     req = entity._cw
    30     w(u'<div class="sideBox">')
    30     w(u'<div class="sideBox">')
    31     if title is None:
    31     if title is None:
    32         title = req._('download')
    32         title = req._('download')
    33     w(u'<div class="sideBoxTitle downloadBoxTitle"><span>%s</span></div>'
    33     w(u'<div class="sideBoxTitle downloadBoxTitle"><span>%s</span></div>'
    34       % xml_escape(title))
    34       % xml_escape(title))
   102     def render_entity_attributes(self, entity):
   102     def render_entity_attributes(self, entity):
   103         super(IDownloadablePrimaryView, self).render_entity_attributes(entity)
   103         super(IDownloadablePrimaryView, self).render_entity_attributes(entity)
   104         self.w(u'<div class="content">')
   104         self.w(u'<div class="content">')
   105         contenttype = entity.download_content_type()
   105         contenttype = entity.download_content_type()
   106         if contenttype.startswith('image/'):
   106         if contenttype.startswith('image/'):
   107             self.wview('image', entity.rset, row=entity.row)
   107             self.wview('image', entity.cw_rset, row=entity.cw_row)
   108         else:
   108         else:
   109             self.wview('downloadlink', entity.rset, title=self._cw._('download'), row=entity.row)
   109             self.wview('downloadlink', entity.cw_rset, title=self._cw._('download'), row=entity.cw_row)
   110             try:
   110             try:
   111                 if ENGINE.has_input(contenttype):
   111                 if ENGINE.has_input(contenttype):
   112                     self.w(entity.printable_value('data'))
   112                     self.w(entity.printable_value('data'))
   113             except TransformError:
   113             except TransformError:
   114                 pass
   114                 pass