# HG changeset patch # User Sylvain Thénault # Date 1288019752 -7200 # Node ID 0683748bca816d9680a5fe2e5ba5af748ae9c6b6 # Parent 7baea108d3262da07afdc4178c1307fcdf8f342b [primary view] properly deprecates render_entity_[summary|metadata] diff -r 7baea108d326 -r 0683748bca81 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'
') - 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'
%s
' % summary) self.w(u'
') 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'
%s
' % summary) - def summary(self, entity): """default implementation return an empty string""" return u''