fix sameetype overriding
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 08 Feb 2010 21:29:24 +0100
changeset 157 5ebb8152c714
parent 155 b34fc7161e62
child 158 465f38875f92
fix sameetype overriding
views/primary.py
views/secondary.py
--- a/views/primary.py	Sat Feb 06 09:05:40 2010 +0100
+++ b/views/primary.py	Mon Feb 08 21:29:24 2010 +0100
@@ -36,10 +36,11 @@
     def render_entity_relations(self, entity):
         super(BlogPrimaryView, self).render_entity_relations(entity)
         rset = entity.related('entry_of', 'object')
-        strio = UStringIO()
-        self.paginate(self._cw, w=strio.write, page_size=10, rset=rset)
-        self.wview('adaptedlist', rset, 'null')
-        self.w(strio.getvalue())
+        if rset:
+            strio = UStringIO()
+            self.paginate(self._cw, w=strio.write, page_size=10, rset=rset)
+            self.wview('sameetypelist', rset)
+            self.w(strio.getvalue())
 
     def render_entity_title(self, entity):
         self.w(u'<h1>%s</h1>' % xml_escape(entity.dc_title()))
--- a/views/secondary.py	Sat Feb 06 09:05:40 2010 +0100
+++ b/views/secondary.py	Mon Feb 08 21:29:24 2010 +0100
@@ -1,7 +1,7 @@
 """Secondary views for blogs
 
 :organization: Logilab
-:copyright: 2003-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:copyright: 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
 """
 __docformat__ = "restructuredtext en"
@@ -142,13 +142,15 @@
 
 ## list views ##################################################################
 
-class BlogEntryAdaptedListView(baseviews.AdaptedListView):
-    __select__ = baseviews.AdaptedListView.__select__ & implements('BlogEntry')
+class BlogEntrySameETypeListView(baseviews.SameETypeListView):
+    __select__ = baseviews.SameETypeListView.__select__ & implements('BlogEntry')
     countrql = 'Any COUNT(B) WHERE B is BlogEntry, B creation_date >=  %(firstday)s, B creation_date <= %(lastday)s'
+    item_vid = 'blog'
 
     def call(self, **kwargs):
         self._cw.add_css('cubes.blog.css')
-        super(BlogEntryAdaptedListView, self).call(**kwargs)
+        print 'yoooo'
+        super(BlogEntrySameETypeListView, self).call(**kwargs)
         if 'year' in self._cw.form and 'month' in self._cw.form:
             self.render_next_previous(int(self._cw.form['year']), int(self._cw.form['month']))
 
@@ -191,10 +193,6 @@
             return u'<a href="%s" title="">%s</a>' % (url, atitle)
         return u''
 
-class BlogEntryAdaptedListItemView(baseviews.AdaptedListItemView):
-    __select__ = baseviews.AdaptedListView.__select__ & implements('BlogEntry')
-    redirect_vid = 'blog'
-
 
 class BlogEntryBlogView(EntityView):
     __regid__ = 'blog'