# HG changeset patch
# User Sandrine Ribeau <sandrine.ribeau@logilab.fr>
# Date 1260353004 -3600
#      Wed Dec 09 11:03:24 2009 +0100
# Node ID fbd643f1833c6c299eaa1b6e6f0e86a086000edc
# Parent  bf68e8d1d3e75d57eef88e75e67c4694ae77226d
cw 3.6 api update

diff --git a/entities.py b/entities.py
--- a/entities.py
+++ b/entities.py
@@ -75,7 +75,7 @@
 
     def postinfo_description(self):
         _ = self._cw._
-        descr = u'%s %s' % (_('posted on'), self.format_date(self.creation_date))
+        descr = u'%s %s' % (_('posted on'), self._cw.format_date(self.creation_date))
         return descr
 
     # isioc interface ##########################################################
diff --git a/test/unittest_blog.py b/test/unittest_blog.py
--- a/test/unittest_blog.py
+++ b/test/unittest_blog.py
@@ -13,10 +13,10 @@
     """test blog specific behaviours"""
 
     def test_notifications(self):
-        cubicweb_blog = self.add_entity('Blog', title=u'cubicweb', description=u"cubicweb c'est beau")
-        blog_entry_1 = self.add_entity('BlogEntry', title=u"hop", content=u"cubicweb hop")
+        cubicweb_blog = self.request().create_entity('Blog', title=u'cubicweb', description=u"cubicweb c'est beau")
+        blog_entry_1 = self.request().create_entity('BlogEntry', title=u"hop", content=u"cubicweb hop")
         self.execute('SET E entry_of B WHERE B eid %(beid)s, E eid %(eeid)s' % {'beid' :cubicweb_blog.eid, 'eeid' : blog_entry_1.eid})
-        blog_entry_2 = self.add_entity('BlogEntry', title=u"yes",  content=u"cubicweb yes")
+        blog_entry_2 = self.request().create_entity('BlogEntry', title=u"yes",  content=u"cubicweb yes")
         self.execute('SET E entry_of B WHERE B eid %(beid)s, E eid %(eeid)s' % {'beid' :cubicweb_blog.eid, 'eeid' : blog_entry_2.eid})
         session = self.session
         for op in session.pending_operations:
diff --git a/views/secondary.py b/views/secondary.py
--- a/views/secondary.py
+++ b/views/secondary.py
@@ -184,7 +184,7 @@
         nmb_entries = self._cw.execute(self.countrql, args)[0][0]
         label = u'%s %s [%s]' % (self._cw._(calendar.MONTHNAMES[month-1]), year,
                                  nmb_entries)
-        vtitle = '%s %s' % (display_name('BlogEntry', 'plural'), label)
+        vtitle = '%s %s' % (display_name(self._cw, 'BlogEntry', 'plural'), label)
         url = xml_escape(self._cw.build_url('view', rql=rql, vtitle=vtitle,
                                         month=month, year=year))
         if self._cw.execute(rql):
@@ -201,7 +201,7 @@
     __select__ = implements('BlogEntry')
 
     def cell_call(self, row, col):
-        entity = self.entity(row, col)
+        entity = self.cw_rset.get_entity(row, col)
         w = self.w
         _ = self._cw._
         w(u'<div class="post">')
@@ -228,11 +228,11 @@
     __select__ = implements('BlogEntry')
 
     def cell_call(self, row, col):
-        entity = self.entity(row, col)
+        entity = self.cw_rset.get_entity(row, col)
         _ = lambda ertype, form='': display_name(self._cw, ertype, form)
         reldata = []
         w = reldata.append
-        if 'comments' in self.schema and 'BlogEntry' in self.schema.rschema('comments').objects():
+        if 'comments' in self._cw.vreg.schema and 'BlogEntry' in self._cw.vreg.schema.rschema('comments').objects():
             count = self.req.execute('Any COUNT(C) WHERE C comments B, B eid %(x)s',
                                      {'x': entity.eid}, 'x')[0][0]
             if count:
@@ -240,14 +240,14 @@
                 w(u'<a href="%s">%s %s</a>' % (url, count, _('Comment', 'plural')))
             else:
                 w(u'%s %s' % (count, _('Comment')))
-        if 'tags' in self.schema and 'BlogEntry' in self.schema.rschema('tags').objects():
+        if 'tags' in self._cw.vreg.schema and 'BlogEntry' in self._cw.vreg.schema.rschema('tags').objects():
             tag_rset = entity.related('tags', 'object')
             if tag_rset:
-                w(u'%s %s' % (_('tags', 'object'), self.view('csv', tag_rset)))
+                w(u'%s %s' % (_('tags', 'object'), self._cw.view('csv', tag_rset)))
         rset = entity.related('entry_of', 'subject')
         if rset:
             w(u'%s %s' % (self._cw._('blogged in '),
-                          self.view('csv', rset, 'null')))
+                          self._cw.view('csv', rset, 'null')))
         self.w(u' | '.join(reldata))