add render_description method to RSSItemView to improve modularity. stable
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Thu, 04 Mar 2010 09:35:34 +0100
branchstable
changeset 4785 1fa7363c78bd
parent 4784 eed95a456b88
child 4786 df2a12bfbab6
add render_description method to RSSItemView to improve modularity. The construction of the description marker of and rss entry is currently built by the main cell_call function. This make the job hard for RSSItemView subclass to change the default behaviour. The changeset fix this issue by extracting the description creation into a render_description method. Such extraction are already in place for various rss marquer.
web/views/xmlrss.py
--- a/web/views/xmlrss.py	Fri Feb 26 17:00:42 2010 +0100
+++ b/web/views/xmlrss.py	Thu Mar 04 09:35:34 2010 +0100
@@ -188,11 +188,14 @@
         self.w(u'<guid isPermaLink="true">%s</guid>\n'
                % xml_escape(entity.absolute_url()))
         self.render_title_link(entity)
-        self._marker('description', entity.dc_description(format='text/html'))
+        self.render_description(entity)
         self._marker('dc:date', entity.dc_date(self.date_format))
         self.render_entity_creator(entity)
         self.w(u'</item>\n')
 
+    def render_description(self, entity):
+        self._marker('description', entity.dc_description(format='text/html'))
+
     def render_title_link(self, entity):
         self._marker('title', entity.dc_long_title())
         self._marker('link', entity.absolute_url())