diff -r 536e421b082b -r 6a25c58a1c23 web/views/idownloadable.py --- a/web/views/idownloadable.py Mon Mar 02 20:44:14 2009 +0100 +++ b/web/views/idownloadable.py Mon Mar 02 21:03:54 2009 +0100 @@ -17,6 +17,12 @@ _ = unicode +def is_image(entity): + mt = entity.download_content_type() + if not (mt and mt.startswith('image/')): + return 0 + return 1 + def download_box(w, entity, title=None, label=None): req = entity.req w(u'
') w(u'\n\n') - + class DownloadBox(EntityBoxTemplate): id = 'download_box' - __select__ = (one_line_rset() & implements(IDownloadable) & match_context_prop()) + # no download box for images + # XXX primary_view selector ? + __select__ = (one_line_rset() & implements(IDownloadable) & match_context_prop() & ~ score_entity(is_image) order = 10 + def cell_call(self, row, col, title=None, label=None, **kwargs): entity = self.entity(row, col) download_box(self.w, entity, title, label) @@ -87,7 +96,8 @@ class IDownloadablePrimaryView(baseviews.PrimaryView): __select__ = implements(IDownloadable) - #skip_attrs = ('eid', 'data',) # XXX + # XXX File/Image attributes but this is not specified in the IDownloadable interface + skip_attrs = baseviews.PrimaryView.skip_attrs + ('data', 'name') def render_entity_title(self, entity): self.w(u'