Skip to content

Commit a70ccdc

Browse files
author
Richard Jones
committed
Added the Roundup spec to the new documentation directory.
1 parent 76862a3 commit a70ccdc

File tree

8 files changed

+1567
-11
lines changed

8 files changed

+1567
-11
lines changed

doc/images/logo-acl-medium.gif

5.91 KB
Loading
3.27 KB
Loading
16.1 KB
Loading

doc/spec.html

Lines changed: 1544 additions & 0 deletions
Large diffs are not rendered by default.

roundup/backends/back_anydbm.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#$Id: back_anydbm.py,v 1.2 2001-07-23 08:20:44 richard Exp $
1+
#$Id: back_anydbm.py,v 1.3 2001-07-25 01:23:07 richard Exp $
22

33
import anydbm, os, marshal
44
from roundup import hyperdb, date
@@ -66,7 +66,10 @@ def getclassdb(self, classname, mode='r'):
6666
multiple actions
6767
'''
6868
path = os.path.join(os.getcwd(), self.dir, 'nodes.%s'%classname)
69-
return anydbm.open(path, mode)
69+
if os.path.exists(path):
70+
return anydbm.open(path, mode)
71+
else:
72+
return anydbm.open(path, 'n')
7073

7174
#
7275
# Nodes
@@ -100,6 +103,7 @@ def getnode(self, classname, nodeid, cldb=None):
100103
# convert the marshalled data to instances
101104
properties = self.classes[classname].properties
102105
for key in res.keys():
106+
if key == self.RETIRED_FLAG: continue
103107
if properties[key].isDateType:
104108
res[key] = date.Date(res[key])
105109
elif properties[key].isIntervalType:
@@ -197,4 +201,9 @@ def rollback(self):
197201

198202
#
199203
#$Log: not supported by cvs2svn $
204+
#Revision 1.2 2001/07/23 08:20:44 richard
205+
#Moved over to using marshal in the bsddb and anydbm backends.
206+
#roundup-admin now has a "freshen" command that'll load/save all nodes (not
207+
# retired - mod hyperdb.Class.list() so it lists retired nodes)
208+
#
200209
#

roundup/templates/extended/dbinit.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: dbinit.py,v 1.5 2001-07-23 23:20:35 richard Exp $
1+
# $Id: dbinit.py,v 1.6 2001-07-25 01:23:07 richard Exp $
22

33
import os
44

@@ -25,8 +25,6 @@ class IssueClass(roundupdb.IssueClass):
2525
def open(name=None):
2626
''' as from the roundupdb method openDB
2727
28-
storagelocator must be the directory the __init__.py file is in
29-
- os.path.split(__file__)[0] gives us that I think
3028
'''
3129
from roundup.hyperdb import String, Date, Link, Multilink
3230

@@ -96,9 +94,6 @@ def open(name=None):
9694
def init(adminpw):
9795
''' as from the roundupdb method initDB
9896
99-
storagelocator must be the directory the __init__.py file is in
100-
- os.path.split(__file__)[0] gives us that I think
101-
10297
Open the new database, and set up a bunch of attributes.
10398
10499
'''
@@ -156,6 +151,9 @@ def init(adminpw):
156151

157152
#
158153
# $Log: not supported by cvs2svn $
154+
# Revision 1.5 2001/07/23 23:20:35 richard
155+
# forgot to remove the interfaces from the dbinit module ;)
156+
#
159157
# Revision 1.4 2001/07/23 08:45:28 richard
160158
# ok, so now "./roundup-admin init" will ask questions in an attempt to get a
161159
# workable instance_home set up :)

tests/test_db.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@ def testChanges(self):
3535
self.db.issue.create(title="arguments", status='2')
3636
self.db.issue.create(title="abuse", status='1')
3737
self.db.issue.addprop(fixer=Link("user"))
38-
self.db.issue.getprops()
39-
#{"title": <hyperdb.String>, "status": <hyperdb.Link to "status">,
40-
#"user": <hyperdb.Link to "user">}
38+
props = self.db.issue.getprops()
39+
keys = props.keys()
40+
keys.sort()
41+
self.assertEqual(keys, ['title', 'status', 'user'], 'wrong prop list')
4142
self.db.issue.set('5', status=2)
4243
self.db.issue.get('5', "status")
4344
self.db.status.get('2', "name")
@@ -47,6 +48,8 @@ def testChanges(self):
4748
self.db.status.history('1')
4849
self.db.status.history('2')
4950

51+
def testExceptions(self):
52+
# this tests the exceptions that should be raised
5053

5154
def suite():
5255
return unittest.makeSuite(DBTestCase, 'test')

tests/test_schema.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,11 @@ def testA_Status(self):
4242

4343
def testB_Issue(self):
4444
issue = Class(self.db, "issue", title=String(), status=Link("status"))
45+
self.assert_(issue, 'no class object returned')
4546

4647
def testC_User(self):
4748
user = Class(self.db, "user", username=String(), password=String())
49+
self.assert_(user, 'no class object returned')
4850
user.setkey("username")
4951

5052

0 commit comments

Comments
 (0)