Mercurial > p > roundup > code
diff roundup/backends/back_bsddb3.py @ 275:1cc866cec608
Moved the data stringification up into the hyperdb.Class class's...
...get, set and create methods. This means that the data is also
stringified for the journal call, and removes duplication of code from
the backends. The backend code now only sees strings.
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Tue, 09 Oct 2001 23:58:10 +0000 |
| parents | a4241ddd22d7 |
| children | f43af1e97fdd |
line wrap: on
line diff
--- a/roundup/backends/back_bsddb3.py Tue Oct 09 23:36:25 2001 +0000 +++ b/roundup/backends/back_bsddb3.py Tue Oct 09 23:58:10 2001 +0000 @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -#$Id: back_bsddb3.py,v 1.8 2001-10-09 07:25:59 richard Exp $ +#$Id: back_bsddb3.py,v 1.9 2001-10-09 23:58:10 richard Exp $ import bsddb3, os, marshal from roundup import hyperdb, date, password @@ -95,17 +95,6 @@ ''' add the specified node to its class's db ''' db = self.getclassdb(classname, 'c') - - # convert the instance data to builtin types - properties = self.classes[classname].properties - for key in properties.keys(): - if isinstance(properties[key], hyperdb.Date): - node[key] = node[key].get_tuple() - elif isinstance(properties[key], hyperdb.Interval): - node[key] = node[key].get_tuple() - elif isinstance(properties[key], hyperdb.Password): - node[key] = str(node[key]) - # now save the marshalled data db[nodeid] = marshal.dumps(node) db.close() @@ -118,19 +107,6 @@ if not db.has_key(nodeid): raise IndexError, nodeid res = marshal.loads(db[nodeid]) - - # convert the marshalled data to instances - properties = self.classes[classname].properties - for key in properties.keys(): - if isinstance(properties[key], hyperdb.Date): - res[key] = date.Date(res[key]) - elif isinstance(properties[key], hyperdb.Interval): - res[key] = date.Interval(res[key]) - elif isinstance(properties[key], hyperdb.Password): - p = password.Password() - p.unpack(res[key]) - res[key] = p - if not cldb: db.close() return res @@ -225,6 +201,10 @@ # #$Log: not supported by cvs2svn $ +#Revision 1.8 2001/10/09 07:25:59 richard +#Added the Password property type. See "pydoc roundup.password" for +#implementation details. Have updated some of the documentation too. +# #Revision 1.7 2001/08/12 06:32:36 richard #using isinstance(blah, Foo) now instead of isFooType #
