remove deprecated .entity(0) calls (closes #2189225) stable
authorAdrien Di Mascio <Adrien.DiMascio@logilab.fr>
Mon, 20 Feb 2012 12:15:21 +0100
branchstable
changeset 121 393fad2f3087
parent 120 3f788c7b4512
child 122 f77ce7b94953
child 123 bf94b01b0ae3
remove deprecated .entity(0) calls (closes #2189225)
sobjects.py
views.py
--- a/sobjects.py	Mon Sep 12 16:53:42 2011 +0200
+++ b/sobjects.py	Mon Feb 20 12:15:21 2012 +0100
@@ -18,14 +18,14 @@
 
     def recipients(self):
         """Returns the project's interested people (entities)"""
-        creator = self.entity(0).created_by[0]
+        creator = self.cw_rset.get_entity(0, 0).created_by[0]
         if not creator.is_in_group('managers') and creator.primary_email:
             return [(creator.primary_email[0].address, 'fr')]
         return []
 
     def context(self, **kwargs):
         context = NotificationView.context(self, **kwargs)
-        entity = self.entity(0)
+        entity = self.cw_rset.get_entity(0, 0)
         context['kw'] = entity.name
         return context
 
@@ -45,12 +45,12 @@
             return u'?'
 
     def context(self, **kwargs):
-        entity = self.entity(0)
+        entity = self.cw_rset.get_entity(0, 0)
         context = KeywordNotificationView.context(self, **kwargs)
         context['oldname'] = self.get_oldname(entity)
         return context
 
     def subject(self):
-        entity = self.entity(0)
+        entity = self.cw_rset.get_entity(0, 0)
         return self.req._('keyword name changed from %s to %s') % (
             self.get_oldname(entity), entity.name)
--- a/views.py	Mon Sep 12 16:53:42 2011 +0200
+++ b/views.py	Mon Feb 20 12:15:21 2012 +0100
@@ -130,7 +130,7 @@
 
     def get_keywords(self):
         """helper method for subclasses redefinition"""
-        entity = self.entity(0)
+        entity = self.cw_rset.get_entity(0, 0)
         return entity.related('applied_to', 'object')
 
     def call(self, **kwargs):
@@ -156,10 +156,9 @@
     order = 153
     htmlclass = 'navigation'
 
-    def call(self):
+    def entity_call(self, entity, view=None):
         self.add_js(['cubicweb.widgets.js', 'cubes.keyword.js'])
         self._cw.add_css('cubicweb.suggest.css')
-        entity = self.entity(0)
         self.w(u'<table><tr><td>')
         self.w(u'<a class="button sglink" href="javascript: showKeywordSelector(%s, \'%s\', \'%s\');">%s</a></td>' % (
             entity.eid, self._cw._(stdmsgs.BUTTON_OK[0]),