changeset 2762:638fc2dab5a1 maint-0.7

fixed editing of message contents
author Richard Jones <richard@users.sourceforge.net>
date Fri, 15 Oct 2004 01:10:22 +0000
parents 595f8bc5829a
children 65337f817b50
files CHANGES.txt roundup/backends/blobfiles.py roundup/backends/rdbms_common.py
diffstat 3 files changed, 18 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES.txt	Fri Oct 15 00:25:05 2004 +0000
+++ b/CHANGES.txt	Fri Oct 15 01:10:22 2004 +0000
@@ -4,6 +4,7 @@
 2004-10-?? 0.7.9
 Fixed:
 - popup listing uses filter args (thanks Marlon van den Berg)
+- fixed editing of message contents
 
 
 2004-10-15 0.7.8
--- a/roundup/backends/blobfiles.py	Fri Oct 15 00:25:05 2004 +0000
+++ b/roundup/backends/blobfiles.py	Fri Oct 15 01:10:22 2004 +0000
@@ -15,7 +15,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
-#$Id: blobfiles.py,v 1.12.2.1 2004-06-24 07:14:48 richard Exp $
+#$Id: blobfiles.py,v 1.12.2.2 2004-10-15 01:10:22 richard Exp $
 '''This module exports file storage for roundup backends.
 Files are stored into a directory hierarchy.
 '''
@@ -79,11 +79,11 @@
 
         # save to a temp file
         name = name + '.tmp'
-        # make sure we don't register the rename action more than once
-        if not os.path.exists(name):
-            # save off the rename action
-            self.transactions.append((self.doStoreFile, (classname, nodeid,
-                property)))
+
+        # save off the rename action
+        self.transactions.append((self.doStoreFile, (classname, nodeid,
+            property)))
+
         open(name, 'wb').write(content)
 
     def getfile(self, classname, nodeid, property):
@@ -117,6 +117,9 @@
         # determine the name of the file to write to
         name = self.filename(classname, nodeid, property)
 
+        if not os.path.exists(name+".tmp"):
+            return
+
         # content is being updated (and some platforms, eg. win32, won't
         # let us rename over the top of the old file)
         if os.path.exists(name):
--- a/roundup/backends/rdbms_common.py	Fri Oct 15 00:25:05 2004 +0000
+++ b/roundup/backends/rdbms_common.py	Fri Oct 15 01:10:22 2004 +0000
@@ -1,4 +1,4 @@
-# $Id: rdbms_common.py,v 1.98.2.24 2004-10-14 22:28:02 richard Exp $
+# $Id: rdbms_common.py,v 1.98.2.25 2004-10-15 01:10:22 richard Exp $
 ''' Relational database (SQL) backend common code.
 
 Basics:
@@ -2655,19 +2655,23 @@
             content = propvalues['content']
             del propvalues['content']
 
-        # do the database create
+        # do the database set
         propvalues = self.set_inner(itemid, **propvalues)
 
         # do content?
         if content:
             # store and index
             self.db.storefile(self.classname, itemid, None, content)
-            mime_type = propvalues.get('type', self.get(itemid, 'type'))
-            if not mime_type:
+            if self.getprops().has_key('type'):
+                mime_type = propvalues.get('type', self.get(itemid, 'type',
+                    self.default_mime_type))
+            else:
                 mime_type = self.default_mime_type
             self.db.indexer.add_text((self.classname, itemid, 'content'),
                 content, mime_type)
 
+        propvalues['content'] = content
+
         # fire reactors
         self.fireReactors('set', itemid, oldvalues)
         return propvalues

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