IFeed adapter working with MicroBlog as well as Blog
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 12 Oct 2010 18:17:59 +0200
changeset 246 8482731e12b4
parent 245 ffcb398f540e
child 247 5d8466f096dc
IFeed adapter working with MicroBlog as well as Blog
entities.py
--- a/entities.py	Tue Oct 12 18:17:59 2010 +0200
+++ b/entities.py	Tue Oct 12 18:17:59 2010 +0200
@@ -15,13 +15,13 @@
 
 class BlogIFeedAdapter(EntityAdapter):
     __regid__ = 'IFeed'
-    __select__ = is_instance('Blog')
+    __select__ = is_instance('Blog', 'MicroBlog')
 
     def rss_feed_url(self):
-        if self.entity.rss_url:
+        if getattr(self.entity, 'rss_url', None):
             return self.entity.rss_url
         rql = ('Any E ORDERBY D DESC '
-               'WHERE E is BlogEntry, E entry_of X, X eid %s, E creation_date D'
+               'WHERE E entry_of X, X eid %s, E creation_date D'
                )
         return self._cw.build_url(rql=rql % self.entity.eid, vid='rss',
                                   vtitle=self.entity.dc_title())