Skip to content

Commit 8d52a31

Browse files
author
Richard Jones
committed
fix anydbm journal import [SF#983166]
fix dumb bug in FileClass index()
1 parent 953c54c commit 8d52a31

File tree

4 files changed

+19
-14
lines changed

4 files changed

+19
-14
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Feature:
1919
Fixed:
2020
- rdbms backend full text search failure after import (sf bug 980314)
2121
- rdbms backends not filtering correctly on link=None
22+
- fix anydbm journal import (sf bug 983166)
2223

2324

2425
2004-06-24 0.7.5

roundup/backends/back_anydbm.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
#$Id: back_anydbm.py,v 1.158 2004-06-28 23:13:05 richard Exp $
18+
#$Id: back_anydbm.py,v 1.159 2004-07-01 03:55:47 richard Exp $
1919
'''This module defines a backend that saves the hyperdatabase in a
2020
database chosen by anydbm. It is guaranteed to always be available in python
2121
versions >2.1.1 (the dumbdbm fallback in 2.1.1 and earlier has several
@@ -708,6 +708,7 @@ def doSetJournal(self, classname, nodeid, journal):
708708
if isinstance(params, type({})):
709709
if action in ('set', 'create'):
710710
params = self.serialise(classname, params)
711+
journaldate = journaldate.serialise()
711712
l.append((nodeid, journaldate, journaltag, action, params))
712713
db = self.getCachedJournalDB(classname)
713714
db[nodeid] = marshal.dumps(l)
@@ -2183,11 +2184,12 @@ def index(self, nodeid):
21832184
Pass on the content-type property for the content property.
21842185
'''
21852186
Class.index(self, nodeid)
2186-
mimetype = self.get(nodeid, 'type')
2187-
if not mimetype:
2188-
mimetype = self.default_mime_type
2187+
try:
2188+
mime_type = self.get(nodeid, 'type', self.default_mime_type)
2189+
except KeyError:
2190+
mime_type = self.default_mime_type
21892191
self.db.indexer.add_text((self.classname, nodeid, 'content'),
2190-
self.get(nodeid, 'content'), mimetype)
2192+
str(self.get(nodeid, 'content')), mime_type)
21912193

21922194
# deviation from spec - was called ItemClass
21932195
class IssueClass(Class, roundupdb.IssueClass):

roundup/backends/back_metakit.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: back_metakit.py,v 1.77 2004-06-28 23:13:05 richard Exp $
1+
# $Id: back_metakit.py,v 1.78 2004-07-01 03:55:47 richard Exp $
22
'''Metakit backend for Roundup, originally by Gordon McMillan.
33
44
Known Current Bugs:
@@ -1951,11 +1951,12 @@ def index(self, nodeid):
19511951
Pass on the content-type property for the content property.
19521952
'''
19531953
Class.index(self, nodeid)
1954-
mimetype = self.get(nodeid, 'type')
1955-
if not mimetype:
1956-
mimetype = self.default_mime_type
1954+
try:
1955+
mime_type = self.get(nodeid, 'type', self.default_mime_type)
1956+
except KeyError:
1957+
mime_type = self.default_mime_type
19571958
self.db.indexer.add_text((self.classname, nodeid, 'content'),
1958-
self.get(nodeid, 'content'), mimetype)
1959+
str(self.get(nodeid, 'content')), mime_type)
19591960

19601961
class IssueClass(Class, roundupdb.IssueClass):
19611962
''' The newly-created class automatically includes the "messages",

roundup/backends/rdbms_common.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: rdbms_common.py,v 1.114 2004-06-29 05:51:38 richard Exp $
1+
# $Id: rdbms_common.py,v 1.115 2004-07-01 03:55:47 richard Exp $
22
''' Relational database (SQL) backend common code.
33
44
Basics:
@@ -2655,9 +2655,10 @@ def index(self, nodeid):
26552655
26562656
Pass on the content-type property for the content property.
26572657
'''
2658-
Class.index(nodeid)
2659-
mime_type = self.get(itemid, 'type')
2660-
if not mime_type:
2658+
Class.index(self, nodeid)
2659+
try:
2660+
mime_type = self.get(nodeid, 'type', self.default_mime_type)
2661+
except KeyError:
26612662
mime_type = self.default_mime_type
26622663
self.db.indexer.add_text((self.classname, nodeid, 'content'),
26632664
str(self.get(nodeid, 'content')), mime_type)

0 commit comments

Comments
 (0)