diff roundup/roundupdb.py @ 3740:1442ba0c4850

fix email change note rendering of multiline properties (patch [SF#1575223])
author Richard Jones <richard@users.sourceforge.net>
date Thu, 09 Nov 2006 01:13:56 +0000
parents 06d7816976bc
children 4efa50393b2d
line wrap: on
line diff
--- a/roundup/roundupdb.py	Thu Nov 09 00:55:33 2006 +0000
+++ b/roundup/roundupdb.py	Thu Nov 09 01:13:56 2006 +0000
@@ -16,7 +16,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 #
-# $Id: roundupdb.py,v 1.125 2006-09-09 05:50:17 richard Exp $
+# $Id: roundupdb.py,v 1.126 2006-11-09 01:13:56 richard Exp $
 
 """Extending hyperdb with types specific to issue-tracking.
 """
@@ -496,6 +496,10 @@
                     value = [link.get(entry, key) for entry in value]
                 value.sort()
                 value = ', '.join(value)
+            else:
+                value = str(value)
+                if '\n' in value:
+                    value = '\n'+self.indentChangeNoteValue(value)
             m.append('%s: %s'%(propname, value))
         m.insert(0, '----------')
         m.insert(0, '')
@@ -587,10 +591,19 @@
                     change += ' -%s'%(', '.join(l))
             else:
                 change = '%s -> %s'%(oldvalue, value)
+                if '\n' in change:
+                    value = self.indentChangeNoteValue(str(value))
+                    oldvalue = self.indentChangeNoteValue(str(oldvalue))
+                    change = '\nNow:\n%s\nWas:\n%s'%(value, oldvalue)
             m.append('%s: %s'%(propname, change))
         if m:
             m.insert(0, '----------')
             m.insert(0, '')
         return '\n'.join(m)
 
+    def indentChangeNoteValue(self, text):
+        lines = text.rstrip('\n').split('\n')
+        lines = [ '  '+line for line in lines ]
+        return '\n'.join(lines)
+
 # vim: set filetype=python sts=4 sw=4 et si :

Roundup Issue Tracker: http://roundup-tracker.org/