diff --git a/entities.py b/entities.py index bf68e8d1d3e75d57eef88e75e67c4694ae77226d_ZW50aXRpZXMucHk=..fbd643f1833c6c299eaa1b6e6f0e86a086000edc_ZW50aXRpZXMucHk= 100644 --- 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 index bf68e8d1d3e75d57eef88e75e67c4694ae77226d_dGVzdC91bml0dGVzdF9ibG9nLnB5..fbd643f1833c6c299eaa1b6e6f0e86a086000edc_dGVzdC91bml0dGVzdF9ibG9nLnB5 100644 --- a/test/unittest_blog.py +++ b/test/unittest_blog.py @@ -13,6 +13,6 @@ """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}) @@ -18,5 +18,5 @@ 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 index bf68e8d1d3e75d57eef88e75e67c4694ae77226d_dmlld3Mvc2Vjb25kYXJ5LnB5..fbd643f1833c6c299eaa1b6e6f0e86a086000edc_dmlld3Mvc2Vjb25kYXJ5LnB5 100644 --- 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,7 +228,7 @@ __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 @@ -232,7 +232,7 @@ _ = 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,6 +240,6 @@ 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: @@ -244,6 +244,6 @@ 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 '), @@ -247,7 +247,7 @@ 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))