[primary view] properly deprecates render_entity_[summary|metadata]
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 25 Oct 2010 17:15:52 +0200
changeset 6634 0683748bca81
parent 6633 7baea108d326
child 6635 4e560631f36d
[primary view] properly deprecates render_entity_[summary|metadata]
web/views/primary.py
--- a/web/views/primary.py	Mon Oct 25 17:15:52 2010 +0200
+++ b/web/views/primary.py	Mon Oct 25 17:15:52 2010 +0200
@@ -22,6 +22,7 @@
 
 from warnings import warn
 
+from logilab.common.deprecation import deprecated
 from logilab.mtconverter import xml_escape
 
 from cubicweb import Unauthorized, NoSelectableObject
@@ -68,7 +69,15 @@
             boxes = None
         if boxes or hasattr(self, 'render_side_related'):
             self.w(u'<table width="100%"><tr><td style="width: 75%">')
-        self.render_entity_summary(entity)
+        if hasattr(self, 'render_entity_summary'):
+            warn('[3.10] render_entity_summary method is deprecated (%s)' % self,
+                 DeprecationWarning)
+            self.render_entity_summary(entity)
+        summary = self.summary(entity)
+        if summary:
+            warn('[3.10] summary method is deprecated (%s)' % self,
+                 DeprecationWarning)
+            self.w(u'<div class="summary">%s</div>' % summary)
         self.w(u'<div class="mainInfo">')
         self.content_navigation_components('navcontenttop')
         self.render_entity_attributes(entity)
@@ -111,14 +120,10 @@
     def render_entity_toolbox(self, entity):
         self.content_navigation_components('ctxtoolbar')
 
+    @deprecated('[3.8] render_entity_metadata method is deprecated')
     def render_entity_metadata(self, entity):
         entity.view('metadata', w=self.w)
 
-    def render_entity_summary(self, entity):
-        summary = self.summary(entity) # deprecate summary?
-        if summary:
-            self.w(u'<div class="summary">%s</div>' % summary)
-
     def summary(self, entity):
         """default implementation return an empty string"""
         return u''