adding two different rss feed component
authorLaure Bourgois <Laure.Bourgois@logilab.fr>
Tue, 25 Nov 2008 17:44:35 +0100
changeset 143 c4f11f70b75e
parent 142 0425ee84cfa6
child 144 3159772915c4
adding two different rss feed component
web/views/basecomponents.py
web/views/boxes.py
--- a/web/views/basecomponents.py	Tue Nov 25 17:41:16 2008 +0100
+++ b/web/views/basecomponents.py	Tue Nov 25 17:44:35 2008 +0100
@@ -234,3 +234,19 @@
         self.w(u'&nbsp;|&nbsp;'.join(html))
         self.w(u'</div>')
         
+
+
+class RSSFeedURL(VComponent):
+    id = 'rss_feed_url'
+    __selectors__ = (nfentity_selector,)
+    
+    def feed_url(self):
+        return self.build_url(rql=self.limited_rql(), vid='rss')
+
+class RSSEntityFeedURL(VComponent):
+    id = 'rss_feed_url'
+    __selectors__ = (nfentity_selector, onelinerset_selector)
+    
+    def feed_url(self):
+        return self.entity(0, 0).rss_feed_url()
+
--- a/web/views/boxes.py	Tue Nov 25 17:41:16 2008 +0100
+++ b/web/views/boxes.py	Tue Nov 25 17:44:35 2008 +0100
@@ -183,6 +183,7 @@
             box.render(self.w)
 
 
+        
 class RSSIconBox(ExtResourcesBoxTemplate):
     """just display the RSS icon on uniform result set"""
     __selectors__ = ExtResourcesBoxTemplate.__selectors__ + (appobject_selectable('components', 'rss_feed_url'),)
@@ -198,17 +199,6 @@
         rss = self.req.external_resource('RSS_LOGO')
         self.w(u'<a href="%s"><img src="%s" border="0" /></a>\n' % (html_escape(url), rss))
 
-class EntityRSSIconBox(RSSIconBox):
-    """just display the RSS icon on uniform result set for a single entity"""
-    __selectors__ = RSSIconBox.__selectors__ + (onelinerset_selector,)
-
-    def call(self, **kwargs):
-        entity = self.entity(0, 0)
-        url = entity.rss_feed_url()
-        eid = entity.eid
-        rss = self.req.external_resource('RSS_LOGO')
-        self.w(u'<a href="%s"><img src="%s" border="0" /></a>\n' %
-               (html_escape(url), rss))
 
 ## warning("schemabox ne marche plus pour le moment")
 ## class SchemaBox(BoxTemplate):