diff -r a64f48dd5fe4 -r 9ab2b4c74baf web/views/timeline.py --- a/web/views/timeline.py Thu May 20 20:47:13 2010 +0200 +++ b/web/views/timeline.py Thu May 20 20:47:55 2010 +0200 @@ -18,14 +18,13 @@ """basic support for SIMILE's timline widgets cf. http://code.google.com/p/simile-widgets/ +""" -""" __docformat__ = "restructuredtext en" from logilab.mtconverter import xml_escape -from cubicweb.interfaces import ICalendarable -from cubicweb.selectors import implements +from cubicweb.selectors import adaptable from cubicweb.view import EntityView, StartupView from cubicweb.web import json @@ -37,11 +36,12 @@ should be properties of entity classes or subviews) """ __regid__ = 'timeline-json' + __select__ = adaptable('ICalendarable') + binary = True templatable = False content_type = 'application/json' - __select__ = implements(ICalendarable) date_fmt = '%Y/%m/%d' def call(self): @@ -74,8 +74,9 @@ 'link': 'http://www.allposters.com/-sp/Portrait-of-Horace-Brodsky-Posters_i1584413_.htm' } """ - start = entity.start - stop = entity.stop + icalendarable = entity.cw_adapt_to('ICalendarable') + start = icalendarable.start + stop = icalendarable.stop start = start or stop if start is None and stop is None: return None @@ -116,7 +117,7 @@ """builds a cubicweb timeline widget node""" __regid__ = 'timeline' title = _('timeline') - __select__ = implements(ICalendarable) + __select__ = adaptable('ICalendarable') paginable = False def call(self, tlunit=None): self._cw.html_headers.define_var('Timeline_urlPrefix', self._cw.datadir_url)