Skip to content

Commit 9762fb3

Browse files
author
Richard Jones
committed
fix some introduced import bugs
1 parent 41af428 commit 9762fb3

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

roundup/backends/back_anydbm.py

Lines changed: 7 additions & 6 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.146.2.21 2004-11-23 23:56:08 richard Exp $
18+
#$Id: back_anydbm.py,v 1.146.2.22 2004-11-25 22:56:14 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
@@ -41,7 +41,6 @@
4141
from roundup.backends import locking
4242
from roundup.hyperdb import String, Password, Date, Interval, Link, \
4343
Multilink, DatabaseError, Boolean, Number, Node
44-
from roundup.date import Range, Date
4544

4645
#
4746
# Now the database
@@ -385,12 +384,14 @@ def serialise(self, classname, node):
385384
properties = self.getclass(classname).getprops()
386385
d = {}
387386
for k, v in node.items():
388-
# if the property doesn't exist, or is the "retired" flag then
389-
# it won't be in the properties dict
390-
if not properties.has_key(k):
387+
if k == self.RETIRED_FLAG:
391388
d[k] = v
392389
continue
393390

391+
# if the property doesn't exist then we really don't care
392+
if not properties.has_key(k):
393+
continue
394+
394395
# get the property spec
395396
prop = properties[k]
396397

@@ -2081,7 +2082,7 @@ def import_journals(self, entries):
20812082
elif isinstance(prop, Date):
20822083
if type(value) == type(()):
20832084
print 'warning: invalid date tuple %r'%(value,)
2084-
value = Date( "2000-1-1" )
2085+
value = date.Date("2000-1-1")
20852086
value = date.Date(value)
20862087
elif isinstance(prop, Interval):
20872088
value = date.Interval(value)

roundup/backends/blobfiles.py

Lines changed: 3 additions & 3 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: blobfiles.py,v 1.12.2.4 2004-11-22 02:38:24 richard Exp $
18+
#$Id: blobfiles.py,v 1.12.2.5 2004-11-25 22:56:14 richard Exp $
1919
'''This module exports file storage for roundup backends.
2020
Files are stored into a directory hierarchy.
2121
'''
@@ -37,7 +37,7 @@ def files_in_dir(dir):
3737

3838
class FileStorage:
3939
"""Store files in some directory structure"""
40-
def filename(self, classname, nodeid, property=None, create=False):
40+
def filename(self, classname, nodeid, property=None, create=0):
4141
'''Determine what the filename for the given node and optionally
4242
property is.
4343
@@ -82,7 +82,7 @@ def storefile(self, classname, nodeid, property, content):
8282
is being saved.
8383
'''
8484
# determine the name of the file to write to
85-
name = self.filename(classname, nodeid, property, create=True)
85+
name = self.filename(classname, nodeid, property, create=1)
8686

8787
# make sure the file storage dir exists
8888
if not os.path.exists(os.path.dirname(name)):

roundup/hyperdb.py

Lines changed: 2 additions & 2 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: hyperdb.py,v 1.97.2.5 2004-10-08 00:57:22 richard Exp $
18+
# $Id: hyperdb.py,v 1.97.2.6 2004-11-25 22:56:14 richard Exp $
1919

2020
"""Hyperdatabase implementation, especially field types.
2121
"""
@@ -787,7 +787,7 @@ def export_files(self, dirname, nodeid):
787787
def import_files(self, dirname, nodeid):
788788
''' Import the "content" property as a file
789789
'''
790-
dest = self.db.filename(self.classname, nodeid)
790+
dest = self.db.filename(self.classname, nodeid, create=1)
791791
x, filename = os.path.split(dest)
792792
x, subdir = os.path.split(x)
793793
source = os.path.join(dirname, self.classname+'-files', subdir,

0 commit comments

Comments
 (0)