--- a/web/htmlwidgets.py Mon May 11 16:28:42 2009 +0200
+++ b/web/htmlwidgets.py Mon May 11 17:01:34 2009 +0200
@@ -278,7 +278,7 @@
attrs = ('%s="%s"' % (name, value) for name, value in attrs.iteritems())
self.w(u'<td %s>' % (' '.join(attrs)))
for cellvid, colindex in column.cellrenderers:
- self.model.render(cellvid, rowindex, colindex, w=self.w)
+ self.model.render_cell(cellvid, rowindex, colindex, w=self.w)
self.w(u'</td>')
self.w(u'</tr>')
self.w(u'</tbody>')
--- a/web/views/tableview.py Mon May 11 16:28:42 2009 +0200
+++ b/web/views/tableview.py Mon May 11 17:01:34 2009 +0200
@@ -221,7 +221,7 @@
return columns
- def render(self, cellvid, row, col, w):
+ def render_cell(self, cellvid, row, col, w):
self.view('cell', self.rset, row=row, col=col, cellvid=cellvid, w=w)
def get_rows(self):
--- a/web/views/timeline.py Mon May 11 16:28:42 2009 +0200
+++ b/web/views/timeline.py Mon May 11 17:01:34 2009 +0200
@@ -29,7 +29,7 @@
__select__ = implements(ICalendarable)
date_fmt = '%Y/%m/%d'
-
+
def call(self):
events = []
for entity in self.rset.entities():
@@ -43,13 +43,13 @@
# FIXME: those properties should be defined by the entity class
def onclick_url(self, entity):
return entity.absolute_url()
-
+
def onclick(self, entity):
url = self.onclick_url(entity)
if url:
return u"javascript: document.location.href='%s'" % url
return None
-
+
def build_event(self, entity):
"""converts `entity` into a JSON object
{'start': '1891',
@@ -77,13 +77,13 @@
event_data['end'] = stop.strftime(self.date_fmt)
return event_data
-
+
class TimelineViewMixIn(object):
widget_class = 'TimelineWidget'
jsfiles = ('cubicweb.timeline-bundle.js', 'cubicweb.widgets.js',
'cubicweb.timeline-ext.js', 'cubicweb.ajax.js')
-
- def render(self, loadurl, tlunit=None):
+
+ def render_url(self, loadurl, tlunit=None):
tlunit = tlunit or self.req.form.get('tlunit')
self.req.add_js(self.jsfiles)
self.req.add_css('timeline-bundle.css')
@@ -107,15 +107,15 @@
self.req.html_headers.define_var('Timeline_urlPrefix', self.req.datadir_url)
rql = self.rset.printable_rql()
loadurl = self.build_url(rql=rql, vid='timeline-json')
- self.render(loadurl, tlunit)
-
-
+ self.render_url(loadurl, tlunit)
+
+
class StaticTimelineView(TimelineViewMixIn, StartupView):
"""similar to `TimelineView` but loads data from a static
JSON file instead of one after a RQL query.
"""
id = 'static-timeline'
-
+
def call(self, loadurl, tlunit=None, wdgclass=None):
self.widget_class = wdgclass or self.widget_class
- self.render(loadurl, tlunit)
+ self.render_url(loadurl, tlunit)