summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: bcf81f8)
raw | patch | inline | side by side (parent: bcf81f8)
author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Tue, 9 Oct 2001 23:58:10 +0000 (23:58 +0000) | ||
committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Tue, 9 Oct 2001 23:58:10 +0000 (23:58 +0000) |
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.
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@283 57a73879-2fb5-44c3-a270-3262357dd7e2
journal call, and removes duplication of code from the backends. The
backend code now only sees strings.
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@283 57a73879-2fb5-44c3-a270-3262357dd7e2
index a7345cd681aadf6ac0e882d65d83d8e8d0731171..0dc2f1da8dbb26951752e65b050b8598b9e9080c 100644 (file)
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-#$Id: back_anydbm.py,v 1.9 2001-10-09 07:25:59 richard Exp $
+#$Id: back_anydbm.py,v 1.10 2001-10-09 23:58:10 richard Exp $
import anydbm, os, marshal
from roundup import hyperdb, date, password
''' 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()
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 key == self.RETIRED_FLAG: continue
- 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
#
#$Log: not supported by cvs2svn $
+#Revision 1.9 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.8 2001/09/29 13:27:00 richard
#CGI interfaces now spit up a top-level index of all the instances they can
#serve.
index 3923fbd66279368154718def6c94ce00a3c375bc..cc4e924e5a52ad353698bd15053c1e1dbdf8a556 100644 (file)
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-#$Id: back_bsddb.py,v 1.10 2001-10-09 07:25:59 richard Exp $
+#$Id: back_bsddb.py,v 1.11 2001-10-09 23:58:10 richard Exp $
import bsddb, os, marshal
from roundup import hyperdb, date, password
''' 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()
setnode = addnode
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
#
#$Log: not supported by cvs2svn $
+#Revision 1.10 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.9 2001/08/12 06:32:36 richard
#using isinstance(blah, Foo) now instead of isFooType
#
index 1fd0eaae92af56a9d6081cab43208dca1986fb64..e710e0840c786ae2ba1a6f7f42386cc7884a262c 100644 (file)
# 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
''' 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()
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
#
#$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
#
diff --git a/roundup/hyperdb.py b/roundup/hyperdb.py
index 4a96b7bf0c8f2df998798cf419987c7a57065f3f..50132c94c70c0a524796cf787f9fc14321cec0cc 100644 (file)
--- a/roundup/hyperdb.py
+++ b/roundup/hyperdb.py
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-# $Id: hyperdb.py,v 1.22 2001-10-09 07:25:59 richard Exp $
+# $Id: hyperdb.py,v 1.23 2001-10-09 23:58:10 richard Exp $
# standard python modules
import cPickle, re, string
if not isinstance(value, date.Interval):
raise TypeError, 'new property "%s" not an Interval'%key
+ # make sure there's data where there needs to be
for key, prop in self.properties.items():
if propvalues.has_key(key):
continue
else:
propvalues[key] = None
+ # convert all data to strings
+ for key, prop in self.properties.items():
+ if isinstance(prop, Date):
+ propvalues[key] = propvalues[key].get_tuple()
+ elif isinstance(prop, Interval):
+ propvalues[key] = propvalues[key].get_tuple()
+ elif isinstance(prop, Password):
+ propvalues[key] = str(propvalues[key])
+
# done
self.db.addnode(self.classname, newid, propvalues)
self.db.addjournal(self.classname, newid, 'create', propvalues)
of this class or a KeyError is raised.
"""
d = self.db.getnode(self.classname, nodeid)
+
+ # convert the marshalled data to instances
+ for key, prop in self.properties.items():
+ if isinstance(prop, Date):
+ d[key] = date.Date(d[key])
+ elif isinstance(prop, Interval):
+ d[key] = date.Interval(d[key])
+ elif isinstance(prop, Password):
+ p = password.Password()
+ p.unpack(d[key])
+ d[key] = p
+
if propname == 'id':
return nodeid
if not d.has_key(propname) and default is not _marker:
elif isinstance(prop, Password):
if not isinstance(value, password.Password):
raise TypeError, 'new property "%s" not a Password'% key
+ propvalues[key] = value = str(value)
elif isinstance(prop, Date):
if not isinstance(value, date.Date):
raise TypeError, 'new property "%s" not a Date'% key
+ propvalues[key] = value = value.get_tuple()
elif isinstance(prop, Interval):
if not isinstance(value, date.Interval):
raise TypeError, 'new property "%s" not an Interval'% key
+ propvalues[key] = value = value.get_tuple()
node[key] = value
#
# $Log: not supported by cvs2svn $
+# Revision 1.22 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.21 2001/10/05 02:23:24 richard
# . roundup-admin create now prompts for property info if none is supplied
# on the command-line.
diff --git a/roundup/password.py b/roundup/password.py
index cc76c31b7edb0c6b00834bc2911bba5c740cac7c..335a7a8707bf6d565bcef4892d77d0f210869555 100644 (file)
--- a/roundup/password.py
+++ b/roundup/password.py
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-# $Id: password.py,v 1.1 2001-10-09 07:25:59 richard Exp $
+# $Id: password.py,v 1.2 2001-10-09 23:58:10 richard Exp $
import sha, re
self.password = m.group(2)
else:
# currently plaintext - encrypt
- self.password = encodePassword(plaintext, self.default_scheme)
+ self.password = encodePassword(encrypted, self.default_scheme)
self.scheme = self.default_scheme
def setPassword(self, plaintext):
#
# $Log: not supported by cvs2svn $
+# Revision 1.1 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.
+#
#
#
# vim: set filetype=python ts=4 sw=4 et si