# HG changeset patch # User Sylvain Thénault <sylvain.thenault@logilab.fr> # Date 1245857382 -7200 # Wed Jun 24 17:29:42 2009 +0200 # Node ID 8e533ff838babb57f379e88490685db30e8780ed # Parent 9986e23c77281095393351f2f41bbd4cb8226e2f cleanup, reminder diff --git a/views.py b/views.py --- a/views.py +++ b/views.py @@ -120,11 +120,10 @@ def call(self, **kwargs): """display blogs archive""" + # XXX turn into a selector count_blogentry = self.req.execute('Any COUNT(B) WHERE B is BlogEntry') - _ = self.req._ - if count_blogentry[0][0] > 0: - box = BoxWidget(_(self.title), id=self.id, islist=False) + box = BoxWidget(self.req._(self.title), id=self.id, islist=False) box.append(boxes.BoxHtml(self.view('blog_archive', None, maxentries=12))) box.render(self.w) @@ -137,12 +136,13 @@ order = 34 def call(self, view=None, **kwargs): - box = BoxWidget(self.req._(self.title), self.id, islist=True) + # XXX turn into a selector rset = self.req.execute('Any X,T,CD ORDERBY CD DESC LIMIT 5 ' 'WHERE X is BlogEntry, X title T, ' 'X creation_date CD') if not rset: return + box = BoxWidget(self.req._(self.title), self.id, islist=True) # TODO - get the date between brakets after link # empty string for title argument to deactivate auto-title for i in xrange(rset.rowcount): @@ -150,13 +150,13 @@ box.append(BoxLink(entity.absolute_url(), html_escape(entity.dc_title()))) rqlst = rset.syntax_tree() rqlst.set_limit(None) - rql = rqlst.as_string(kwargs=rset.args) # en gros... + rql = rqlst.as_string(kwargs=rset.args) url = self.build_url('view', vid='full_list', rql=rql, page_size=10) box.append(BoxLink(url, u'[%s]' % self.req._(u'see more'))) rss_icon = self.req.external_resource('RSS_LOGO_16') # FIXME - could use rss_url defined as a property if available rss_label = u'%s <img src="%s" alt="%s"/>' % ( - self.req._(u'subscribe'), rss_icon, self.req._('rss icon')) + self.req._(u'subscribe'), rss_icon, self.req._('rss icon')) rss_url = self.build_url('view', vid='rss', rql=rql) box.append(BoxLink(rss_url, rss_label)) box.render(self.w)