merge
authorsylvain.thenault@logilab.fr
Mon, 23 Mar 2009 11:26:25 +0100
changeset 1128 43bf9a742961
parent 1124 5548b608b7d9 (current diff)
parent 1127 894685124c68 (diff)
child 1136 9dd50b3f94c4
merge
--- a/sobjects/notification.py	Mon Mar 23 11:26:09 2009 +0100
+++ b/sobjects/notification.py	Mon Mar 23 11:26:25 2009 +0100
@@ -160,8 +160,8 @@
     def context(self, **kwargs):
         entity = self.entity(0, 0)
         for key, val in kwargs.iteritems():
-            if val and val.strip():
-                kwargs[key] = self.req._(val)
+            if val and isinstance(val, unicode) and val.strip():
+               kwargs[key] = self.req._(val)
         kwargs.update({'user': self.user_login(),
                        'eid': entity.eid,
                        'etype': entity.dc_type(),
--- a/web/views/baseviews.py	Mon Mar 23 11:26:09 2009 +0100
+++ b/web/views/baseviews.py	Mon Mar 23 11:26:25 2009 +0100
@@ -681,10 +681,9 @@
         """display a list of entities by calling their <item_vid> view"""
         req = self.req
         self.w(u'<?xml version="1.0" encoding="%s"?>\n' % req.encoding)
-        self.w(u'''<rdf:RDF
+        self.w(u'''<rss version="2.0"
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns="http://purl.org/rss/1.0/"
 >''')
         self.w(u'  <channel rdf:about="%s">\n' % html_escape(req.url()))
         self.w(u'    <title>%s RSS Feed</title>\n' % html_escape(self.page_title()))
@@ -701,8 +700,7 @@
         self.w(u'  </channel>\n')
         for i in xrange(self.rset.rowcount):
             self.cell_call(i, 0)
-        self.w(u'</rdf:RDF>')
-
+        self.w(u'</rss>')       
 
 class RssItemView(EntityView):
     id = 'rssitem'
@@ -711,24 +709,29 @@
     def cell_call(self, row, col):
         entity = self.complete_entity(row, col)
         self.w(u'<item rdf:about="%s">\n' % html_escape(entity.absolute_url()))
+        self.render_title_link(entity)
+        self._marker('description', entity.dc_date(self.description))
+        self._marker('dc:date', entity.dc_date(self.date_format))
+        self.render_entity_creator(entity)
+        self.w(u'</item>\n')
+
+    def render_title_link(self, entity):
         self._marker('title', entity.dc_long_title())
         self._marker('link', entity.absolute_url())
-        self._marker('description', entity.dc_description())
-        self._marker('dc:date', entity.dc_date(self.date_format))
+           
+    def render_entity_creator(self, entity):
         if entity.creator:
             self.w(u'<author>')
             self._marker('name', entity.creator.name())
             email = entity.creator.get_email()
             if email:
                 self._marker('email', email)
-            self.w(u'</author>')
-        self.w(u'</item>\n')
+            self.w(u'</author>')       
         
     def _marker(self, marker, value):
         if value:
             self.w(u'  <%s>%s</%s>\n' % (marker, html_escape(value), marker))
 
-
 class CSVMixIn(object):
     """mixin class for CSV views"""
     templatable = False