summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 93d14d9)
raw | patch | inline | side by side (parent: 93d14d9)
author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Wed, 27 Feb 2002 03:40:59 +0000 (03:40 +0000) | ||
committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Wed, 27 Feb 2002 03:40:59 +0000 (03:40 +0000) |
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@662 57a73879-2fb5-44c3-a270-3262357dd7e2
roundup/backends/back_anydbm.py | patch | blob | history | |
roundup/backends/back_bsddb.py | patch | blob | history | |
roundup/backends/blobfiles.py | patch | blob | history |
index 7c95841eeca0f54bd23b84f0d19f7d6ca65456be..df287d8295a3df930643ec6db4a093465ca3ad08 100644 (file)
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-#$Id: back_anydbm.py,v 1.29 2002-02-25 14:34:31 grubert Exp $
+#$Id: back_anydbm.py,v 1.30 2002-02-27 03:40:59 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
'''
import whichdb, anydbm, os, marshal
-from roundup import hyperdb, date, password
+from roundup import hyperdb, date
from blobfiles import FileStorage
#
if hyperdb.DEBUG:
print 'clear', (self,)
for cn in self.classes.keys():
- for type in 'nodes', 'journals':
+ for dummy in 'nodes', 'journals':
path = os.path.join(self.dir, 'journals.%s'%cn)
if os.path.exists(path):
os.remove(path)
# now insert the journal entry
if db.has_key(nodeid):
s = db[nodeid]
- l = marshal.loads(db[nodeid])
+ l = marshal.loads(s)
l.append(entry)
else:
l = [entry]
#
#$Log: not supported by cvs2svn $
+#Revision 1.29 2002/02/25 14:34:31 grubert
+# . use blobfiles in back_anydbm which is used in back_bsddb.
+# change test_db as dirlist does not work for subdirectories.
+# ATTENTION: blobfiles now creates subdirectories for files.
+#
#Revision 1.28 2002/02/16 09:14:17 richard
# . #514854 ] History: "User" is always ticket creator
#
index b30dacb00c407169ae8362b360c3658189f22b9d..973e7bc8cb8e47728a427e4ce6177c4abd62a48d 100644 (file)
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-#$Id: back_bsddb.py,v 1.15 2002-02-16 09:15:33 richard Exp $
+#$Id: back_bsddb.py,v 1.16 2002-02-27 03:40:59 richard Exp $
'''
This module defines a backend that saves the hyperdatabase in BSDDB.
'''
import bsddb, os, marshal
-from roundup import hyperdb, date, password
+from roundup import hyperdb, date
# these classes are so similar, we just use the anydbm methods
import back_anydbm
db = bsddb.btopen(os.path.join(self.dir, 'journals.%s'%classname), 'c')
if db.has_key(nodeid):
s = db[nodeid]
- l = marshal.loads(db[nodeid])
+ l = marshal.loads(s)
l.append(entry)
else:
l = [entry]
#
#$Log: not supported by cvs2svn $
+#Revision 1.15 2002/02/16 09:15:33 richard
+#forgot to patch bsddb backend too
+#
#Revision 1.14 2002/01/22 07:21:13 richard
#. fixed back_bsddb so it passed the journal tests
#
index 2080ab450dc8b793bbf2cccb2116cca11dd00eb7..52704251fd0c8d9a14bdb82829f778639a6ae3ab 100644 (file)
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-#$Id: blobfiles.py,v 1.1 2002-02-25 14:25:41 grubert Exp $
+#$Id: blobfiles.py,v 1.2 2002-02-27 03:40:59 richard Exp $
'''
This module exports file storage for roundup backends.
Files are stored into a directory hierarchy.
import os, os.path
+def files_in_dir(dir):
+ if not os.path.exists(dir):
+ return 0
+ num_files = 0
+ for dir_entry in os.listdir(dir):
+ full_filename = os.path.join(dir,dir_entry)
+ if os.path.isfile(full_filename):
+ num_files = num_files + 1
+ elif os.path.isdir(full_filename):
+ num_files = num_files + files_in_dir(full_filename)
+ return num_files
+
class FileStorage:
"""Store files in some directory structure"""
- def __init__(self):
- # maybe set "files"
- pass
+# TODO: maybe set "files"
+# def __init__(self):
+# pass
def filename(self, classname, nodeid, property=None):
'''Determine what the filename for the given node and optionally
'''Get number of files in storage, even across subdirectories.
'''
files_dir = os.path.join(self.dir, 'files')
-
- def files_in_dir(dir):
- if not os.path.exists(dir):
- return 0
- num_files = 0
- for dir_entry in os.listdir(dir):
- full_filename = os.path.join(dir,dir_entry)
- if os.path.isfile(full_filename):
- num_files = num_files + 1
- elif os.path.isdir(full_filename):
- num_files = num_files + files_in_dir(full_filename)
- return num_files
-
return files_in_dir(files_dir)
-
+ def _doStoreFile(self, name, **databases):
+ '''Must be implemented by subclass
+ '''
+ raise NotImplementedError