[notification] fix #103822, don't try to wrap text/rest to 80 characters stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 26 Aug 2009 08:04:06 +0200
branchstable
changeset 3004 09ab5e93a02c
parent 3001 74e842e4871a
child 3006 4d85386b06a5
[notification] fix #103822, don't try to wrap text/rest to 80 characters
sobjects/notification.py
--- a/sobjects/notification.py	Tue Aug 25 23:52:07 2009 +0200
+++ b/sobjects/notification.py	Wed Aug 26 08:04:06 2009 +0200
@@ -76,9 +76,10 @@
         except RegistryException:
             return
         comment = entity.printable_value('comment', format='text/plain')
-        if comment:
-            comment = normalize_text(comment, 80,
-                                     rest=entity.comment_format=='text/rest')
+        # XXX don't try to wrap rest until we've a proper transformation (see
+        # #103822)
+        if comment and entity.comment_format != 'text/rest':
+            comment = normalize_text(comment, 80)
         RenderAndSendNotificationView(session, view=view, viewargs={
             'comment': comment, 'previous_state': entity.previous_state.name,
             'current_state': entity.new_state.name})
@@ -175,8 +176,12 @@
         entity = self.entity(self.row or 0, self.col or 0)
         content = entity.printable_value(self.content_attr, format='text/plain')
         if content:
-            contentformat = getattr(entity, self.content_attr + '_format', 'text/rest')
-            content = normalize_text(content, 80, rest=contentformat=='text/rest')
+            contentformat = getattr(entity, self.content_attr + '_format',
+                                    'text/rest')
+            # XXX don't try to wrap rest until we've a proper transformation (see
+            # #103822)
+            if contentformat != 'text/rest':
+                content = normalize_text(content, 80)
         return super(ContentAddedView, self).context(content=content, **kwargs)
 
     def subject(self):