diff -r 66ff0b2f7d03 -r 99f5852f8604 web/views/idownloadable.py --- a/web/views/idownloadable.py Mon Feb 16 16:24:24 2009 +0100 +++ b/web/views/idownloadable.py Mon Feb 16 18:26:13 2009 +0100 @@ -1,7 +1,7 @@ """Specific views for entities implementing IDownloadable :organization: Logilab -:copyright: 2001-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved. +:copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved. :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr """ __docformat__ = "restructuredtext en" @@ -10,8 +10,8 @@ from cubicweb.interfaces import IDownloadable from cubicweb.common.mttransforms import ENGINE -from cubicweb.common.selectors import (one_line_rset, score_entity_selector, - implement_interface, match_context_prop) +from cubicweb.common.selectors import (one_line_rset, score_entity, + implements, match_context_prop) from cubicweb.web.box import EntityBoxTemplate from cubicweb.web.views import baseviews @@ -35,8 +35,7 @@ class DownloadBox(EntityBoxTemplate): id = 'download_box' - __selectors__ = (one_line_rset, implement_interface, match_context_prop) - accepts_interfaces = (IDownloadable,) + __selectors__ = (one_line_rset, implements(IDownloadable), match_context_prop) order = 10 def cell_call(self, row, col, title=None, label=None, **kwargs): entity = self.entity(row, col) @@ -44,12 +43,11 @@ class DownloadView(baseviews.EntityView): - """this view is replacing the deprecated 'download' controller and allow downloading - of entities providing the necessary interface + """this view is replacing the deprecated 'download' controller and allow + downloading of entities providing the necessary interface """ id = 'download' - __selectors__ = (one_line_rset, implement_interface) - accepts_interfaces = (IDownloadable,) + __selectors__ = (one_line_rset, implements(IDownloadable)) templatable = False content_type = 'application/octet-stream' @@ -76,10 +74,9 @@ class DownloadLinkView(baseviews.EntityView): """view displaying a link to download the file""" id = 'downloadlink' + __selectors__ = (implements(IDownloadable),) title = None # should not be listed in possible views - __selectors__ = (implement_interface,) - accepts_interfaces = (IDownloadable,) def cell_call(self, row, col, title=None, **kwargs): entity = self.entity(row, col) @@ -89,9 +86,8 @@ class IDownloadablePrimaryView(baseviews.PrimaryView): - __selectors__ = (implement_interface,) + __selectors__ = (implements(IDownloadable),) #skip_attrs = ('eid', 'data',) # XXX - accepts_interfaces = (IDownloadable,) def render_entity_title(self, entity): self.w(u'