diff roundup/backends/back_anydbm.py @ 2640:b01eca163779

The "type" parameter is supposed to be optional
author Richard Jones <richard@users.sourceforge.net>
date Tue, 27 Jul 2004 04:28:39 +0000
parents 11811b313459
children 1df7d4a41da4
line wrap: on
line diff
--- a/roundup/backends/back_anydbm.py	Tue Jul 27 02:34:14 2004 +0000
+++ b/roundup/backends/back_anydbm.py	Tue Jul 27 04:28:39 2004 +0000
@@ -15,7 +15,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
-#$Id: back_anydbm.py,v 1.168 2004-07-27 01:59:28 richard Exp $
+#$Id: back_anydbm.py,v 1.169 2004-07-27 04:28:39 richard Exp $
 '''This module defines a backend that saves the hyperdatabase in a
 database chosen by anydbm. It is guaranteed to always be available in python
 versions >2.1.1 (the dumbdbm fallback in 2.1.1 and earlier has several
@@ -2118,19 +2118,23 @@
             content = propvalues['content']
             del propvalues['content']
 
-        # do the database create
+        # do the database update
         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/