Code

c6b4468ee94bc51f38bffd12895ce390d40d49b3
[roundup.git] / test / test_db.py
1 #
2 # Copyright (c) 2001 Bizar Software Pty Ltd (http://www.bizarsoftware.com.au/)
3 # This module is free software, and you may redistribute it and/or modify
4 # under the same terms as Python, so long as this copyright message and
5 # disclaimer are retained in their original form.
6 #
7 # IN NO EVENT SHALL BIZAR SOFTWARE PTY LTD BE LIABLE TO ANY PARTY FOR
8 # DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING
9 # OUT OF THE USE OF THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE
10 # POSSIBILITY OF SUCH DAMAGE.
11 #
12 # BIZAR SOFTWARE PTY LTD SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
14 # FOR A PARTICULAR PURPOSE.  THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
17
18 # $Id: test_db.py,v 1.32 2002-07-18 11:41:10 richard Exp $ 
20 import unittest, os, shutil, time
22 from roundup.hyperdb import String, Password, Link, Multilink, Date, \
23     Interval, DatabaseError, Boolean, Number
24 from roundup import date, password
25 from roundup.indexer import Indexer
27 def setupSchema(db, create, module):
28     status = module.Class(db, "status", name=String())
29     status.setkey("name")
30     user = module.Class(db, "user", username=String(), password=Password(),
31         assignable=Boolean(), age=Number())
32     file = module.FileClass(db, "file", name=String(), type=String(),
33         comment=String(indexme="yes"))
34     issue = module.IssueClass(db, "issue", title=String(indexme="yes"),
35         status=Link("status"), nosy=Multilink("user"), deadline=Date(),
36         foo=Interval(), files=Multilink("file"))
37     db.post_init()
38     if create:
39         status.create(name="unread")
40         status.create(name="in-progress")
41         status.create(name="testing")
42         status.create(name="resolved")
43     db.commit()
45 class MyTestCase(unittest.TestCase):
46     def tearDown(self):
47         if os.path.exists('_test_dir'):
48             shutil.rmtree('_test_dir')
50 class config:
51     DATABASE='_test_dir'
52     MAILHOST = 'localhost'
53     MAIL_DOMAIN = 'fill.me.in.'
54     INSTANCE_NAME = 'Roundup issue tracker'
55     ISSUE_TRACKER_EMAIL = 'issue_tracker@%s'%MAIL_DOMAIN
56     ISSUE_TRACKER_WEB = 'http://some.useful.url/'
57     ADMIN_EMAIL = 'roundup-admin@%s'%MAIL_DOMAIN
58     FILTER_POSITION = 'bottom'      # one of 'top', 'bottom', 'top and bottom'
59     ANONYMOUS_ACCESS = 'deny'       # either 'deny' or 'allow'
60     ANONYMOUS_REGISTER = 'deny'     # either 'deny' or 'allow'
61     MESSAGES_TO_AUTHOR = 'no'       # either 'yes' or 'no'
62     EMAIL_SIGNATURE_POSITION = 'bottom'
64 class anydbmDBTestCase(MyTestCase):
65     def setUp(self):
66         from roundup.backends import anydbm
67         # remove previous test, ignore errors
68         if os.path.exists(config.DATABASE):
69             shutil.rmtree(config.DATABASE)
70         os.makedirs(config.DATABASE + '/files')
71         self.db = anydbm.Database(config, 'test')
72         setupSchema(self.db, 1, anydbm)
73         self.db2 = anydbm.Database(config, 'test')
74         setupSchema(self.db2, 0, anydbm)
76     def xtestStringChange(self):
77         self.db.issue.create(title="spam", status='1')
78         self.assertEqual(self.db.issue.get('1', 'title'), 'spam')
79         self.db.issue.set('1', title='eggs')
80         self.assertEqual(self.db.issue.get('1', 'title'), 'eggs')
81         self.db.commit()
82         self.assertEqual(self.db.issue.get('1', 'title'), 'eggs')
83         self.db.issue.create(title="spam", status='1')
84         self.db.commit()
85         self.assertEqual(self.db.issue.get('2', 'title'), 'spam')
86         self.db.issue.set('2', title='ham')
87         self.assertEqual(self.db.issue.get('2', 'title'), 'ham')
88         self.db.commit()
89         self.assertEqual(self.db.issue.get('2', 'title'), 'ham')
91     def xtestLinkChange(self):
92         self.db.issue.create(title="spam", status='1')
93         self.assertEqual(self.db.issue.get('1', "status"), '1')
94         self.db.issue.set('1', status='2')
95         self.assertEqual(self.db.issue.get('1', "status"), '2')
97     def xtestDateChange(self):
98         self.db.issue.create(title="spam", status='1')
99         a = self.db.issue.get('1', "deadline")
100         self.db.issue.set('1', deadline=date.Date())
101         b = self.db.issue.get('1', "deadline")
102         self.db.commit()
103         self.assertNotEqual(a, b)
104         self.assertNotEqual(b, date.Date('1970-1-1 00:00:00'))
105         self.db.issue.set('1', deadline=date.Date())
107     def xtestIntervalChange(self):
108         self.db.issue.create(title="spam", status='1')
109         a = self.db.issue.get('1', "foo")
110         self.db.issue.set('1', foo=date.Interval('-1d'))
111         self.assertNotEqual(self.db.issue.get('1', "foo"), a)
113     def testBooleanChange(self):
114         self.db.user.create(username='foo', assignable='1')
115         a = self.db.user.get('1', 'assignable')
116         self.db.user.set('1', assignable='false')
117         self.assertNotEqual(self.db.user.get('1', 'assignable'), a)
118         self.db.user.set('1', assignable='FaLse')
119         self.db.user.set('1', assignable='nO')
120         self.db.user.set('1', assignable='0')
121         self.db.user.set('1', assignable='tRuE')
122         self.db.user.set('1', assignable='yEs')
123         self.db.user.set('1', assignable='1')
125     def xtestNewProperty(self):
126         ' make sure a new property is added ok '
127         self.db.issue.create(title="spam", status='1')
128         self.db.issue.addprop(fixer=Link("user"))
129         props = self.db.issue.getprops()
130         keys = props.keys()
131         keys.sort()
132         self.assertEqual(keys, ['activity', 'creation', 'creator', 'deadline',
133             'files', 'fixer', 'foo', 'id', 'messages', 'nosy', 'status',
134             'superseder', 'title'])
135         self.assertEqual(self.db.issue.get('1', "fixer"), None)
137     def xtestRetire(self):
138         self.db.issue.create(title="spam", status='1')
139         b = self.db.status.get('1', 'name')
140         a = self.db.status.list()
141         self.db.status.retire('1')
142         # make sure the list is different 
143         self.assertNotEqual(a, self.db.status.list())
144         # can still access the node if necessary
145         self.assertEqual(self.db.status.get('1', 'name'), b)
146         self.db.commit()
147         self.assertEqual(self.db.status.get('1', 'name'), b)
148         self.assertNotEqual(a, self.db.status.list())
150     def xtestSerialisation(self):
151         self.db.issue.create(title="spam", status='1',
152             deadline=date.Date(), foo=date.Interval('-1d'))
153         self.db.commit()
154         assert isinstance(self.db.issue.get('1', 'deadline'), date.Date)
155         assert isinstance(self.db.issue.get('1', 'foo'), date.Interval)
156         self.db.user.create(username="fozzy",
157             password=password.Password('t. bear'))
158         self.db.commit()
159         assert isinstance(self.db.user.get('1', 'password'), password.Password)
161     def xtestTransactions(self):
162         # remember the number of items we started
163         num_issues = len(self.db.issue.list())
164         num_files = self.db.numfiles()
165         self.db.issue.create(title="don't commit me!", status='1')
166         self.assertNotEqual(num_issues, len(self.db.issue.list()))
167         self.db.rollback()
168         self.assertEqual(num_issues, len(self.db.issue.list()))
169         self.db.issue.create(title="please commit me!", status='1')
170         self.assertNotEqual(num_issues, len(self.db.issue.list()))
171         self.db.commit()
172         self.assertNotEqual(num_issues, len(self.db.issue.list()))
173         self.db.rollback()
174         self.assertNotEqual(num_issues, len(self.db.issue.list()))
175         self.db.file.create(name="test", type="text/plain", content="hi")
176         self.db.rollback()
177         self.assertEqual(num_files, self.db.numfiles())
178         for i in range(10):
179             self.db.file.create(name="test", type="text/plain", 
180                     content="hi %d"%(i))
181             self.db.commit()
182         num_files2 = self.db.numfiles()
183         self.assertNotEqual(num_files, num_files2)
184         self.db.file.create(name="test", type="text/plain", content="hi")
185         self.db.rollback()
186         self.assertNotEqual(num_files, self.db.numfiles())
187         self.assertEqual(num_files2, self.db.numfiles())
189     def xtestExceptions(self):
190         # this tests the exceptions that should be raised
191         ar = self.assertRaises
193         #
194         # class create
195         #
196         # string property
197         ar(TypeError, self.db.status.create, name=1)
198         # invalid property name
199         ar(KeyError, self.db.status.create, foo='foo')
200         # key name clash
201         ar(ValueError, self.db.status.create, name='unread')
202         # invalid link index
203         ar(IndexError, self.db.issue.create, title='foo', status='bar')
204         # invalid link value
205         ar(ValueError, self.db.issue.create, title='foo', status=1)
206         # invalid multilink type
207         ar(TypeError, self.db.issue.create, title='foo', status='1',
208             nosy='hello')
209         # invalid multilink index type
210         ar(ValueError, self.db.issue.create, title='foo', status='1',
211             nosy=[1])
212         # invalid multilink index
213         ar(IndexError, self.db.issue.create, title='foo', status='1',
214             nosy=['10'])
216         #
217         # key property
218         # 
219         # key must be a String
220         ar(TypeError, self.db.user.setkey, 'password')
221         # key must exist
222         ar(KeyError, self.db.user.setkey, 'fubar')
224         #
225         # class get
226         #
227         # invalid node id
228         ar(IndexError, self.db.issue.get, '1', 'title')
229         # invalid property name
230         ar(KeyError, self.db.status.get, '2', 'foo')
232         #
233         # class set
234         #
235         # invalid node id
236         ar(IndexError, self.db.issue.set, '1', title='foo')
237         # invalid property name
238         ar(KeyError, self.db.status.set, '1', foo='foo')
239         # string property
240         ar(TypeError, self.db.status.set, '1', name=1)
241         # key name clash
242         ar(ValueError, self.db.status.set, '2', name='unread')
243         # set up a valid issue for me to work on
244         self.db.issue.create(title="spam", status='1')
245         # invalid link index
246         ar(IndexError, self.db.issue.set, '6', title='foo', status='bar')
247         # invalid link value
248         ar(ValueError, self.db.issue.set, '6', title='foo', status=1)
249         # invalid multilink type
250         ar(TypeError, self.db.issue.set, '6', title='foo', status='1',
251             nosy='hello')
252         # invalid multilink index type
253         ar(ValueError, self.db.issue.set, '6', title='foo', status='1',
254             nosy=[1])
255         # invalid multilink index
256         ar(IndexError, self.db.issue.set, '6', title='foo', status='1',
257             nosy=['10'])
259     def xtestJournals(self):
260         self.db.issue.addprop(fixer=Link("user", do_journal='yes'))
261         self.db.user.create(username="mary")
262         self.db.user.create(username="pete")
263         self.db.issue.create(title="spam", status='1')
264         self.db.commit()
266         # journal entry for issue create
267         journal = self.db.getjournal('issue', '1')
268         self.assertEqual(1, len(journal))
269         (nodeid, date_stamp, journaltag, action, params) = journal[0]
270         self.assertEqual(nodeid, '1')
271         self.assertEqual(journaltag, 'test')
272         self.assertEqual(action, 'create')
273         keys = params.keys()
274         keys.sort()
275         self.assertEqual(keys, ['deadline', 'files', 'fixer', 'foo',
276             'messages', 'nosy', 'status', 'superseder', 'title'])
277         self.assertEqual(None,params['deadline'])
278         self.assertEqual(None,params['fixer'])
279         self.assertEqual(None,params['foo'])
280         self.assertEqual([],params['nosy'])
281         self.assertEqual('1',params['status'])
282         self.assertEqual('spam',params['title'])
284         # journal entry for link
285         journal = self.db.getjournal('user', '1')
286         self.assertEqual(1, len(journal))
287         self.db.issue.set('1', fixer='1')
288         self.db.commit()
289         journal = self.db.getjournal('user', '1')
290         self.assertEqual(2, len(journal))
291         (nodeid, date_stamp, journaltag, action, params) = journal[1]
292         self.assertEqual('1', nodeid)
293         self.assertEqual('test', journaltag)
294         self.assertEqual('link', action)
295         self.assertEqual(('issue', '1', 'fixer'), params)
297         # journal entry for unlink
298         self.db.issue.set('1', fixer='2')
299         self.db.commit()
300         journal = self.db.getjournal('user', '1')
301         self.assertEqual(3, len(journal))
302         (nodeid, date_stamp, journaltag, action, params) = journal[2]
303         self.assertEqual('1', nodeid)
304         self.assertEqual('test', journaltag)
305         self.assertEqual('unlink', action)
306         self.assertEqual(('issue', '1', 'fixer'), params)
308         # test disabling journalling
309         # ... get the last entry
310         time.sleep(1)
311         entry = self.db.getjournal('issue', '1')[-1]
312         (x, date_stamp, x, x, x) = entry
313         self.db.issue.disableJournalling()
314         self.db.issue.set('1', title='hello world')
315         self.db.commit()
316         entry = self.db.getjournal('issue', '1')[-1]
317         (x, date_stamp2, x, x, x) = entry
318         # see if the change was journalled when it shouldn't have been
319         self.assertEqual(date_stamp, date_stamp2)
320         self.db.issue.enableJournalling()
321         self.db.issue.set('1', title='hello world 2')
322         self.db.commit()
323         entry = self.db.getjournal('issue', '1')[-1]
324         (x, date_stamp2, x, x, x) = entry
325         # see if the change was journalled
326         self.assertNotEqual(date_stamp, date_stamp2)
328     def xtestPack(self):
329         self.db.issue.create(title="spam", status='1')
330         self.db.commit()
331         self.db.issue.set('1', status='2')
332         self.db.commit()
333         self.db.issue.set('1', status='3')
334         self.db.commit()
335         pack_before = date.Date(". + 1d")
336         self.db.pack(pack_before)
337         journal = self.db.getjournal('issue', '1')
338         self.assertEqual(2, len(journal))
340     def xtestIDGeneration(self):
341         id1 = self.db.issue.create(title="spam", status='1')
342         id2 = self.db2.issue.create(title="eggs", status='2')
343         self.assertNotEqual(id1, id2)
345     def xtestSearching(self):
346         self.db.file.create(content='hello', type="text/plain")
347         self.db.file.create(content='world', type="text/frozz",
348             comment='blah blah')
349         self.db.issue.create(files=['1', '2'], title="flebble plop")
350         self.db.issue.create(title="flebble frooz")
351         self.db.commit()
352         self.assertEquals(self.db.indexer.search(['hello'], self.db.issue),
353             {'1': {'files': ['1']}})
354         self.assertEquals(self.db.indexer.search(['world'], self.db.issue), {})
355         self.assertEquals(self.db.indexer.search(['frooz'], self.db.issue),
356             {'2': {}})
357         self.assertEquals(self.db.indexer.search(['flebble'], self.db.issue),
358             {'2': {}, '1': {}})
360     def xtestReindexing(self):
361         self.db.issue.create(title="frooz")
362         self.db.commit()
363         self.assertEquals(self.db.indexer.search(['frooz'], self.db.issue),
364             {'1': {}})
365         self.db.issue.set('1', title="dooble")
366         self.db.commit()
367         self.assertEquals(self.db.indexer.search(['dooble'], self.db.issue),
368             {'1': {}})
369         self.assertEquals(self.db.indexer.search(['frooz'], self.db.issue), {})
371     def xtestForcedReindexing(self):
372         self.db.issue.create(title="flebble frooz")
373         self.db.commit()
374         self.assertEquals(self.db.indexer.search(['flebble'], self.db.issue),
375             {'1': {}})
376         self.db.indexer.quiet = 1
377         self.db.indexer.force_reindex()
378         self.db.post_init()
379         self.db.indexer.quiet = 9
380         self.assertEquals(self.db.indexer.search(['flebble'], self.db.issue),
381             {'1': {}})
383 class anydbmReadOnlyDBTestCase(MyTestCase):
384     def setUp(self):
385         from roundup.backends import anydbm
386         # remove previous test, ignore errors
387         if os.path.exists(config.DATABASE):
388             shutil.rmtree(config.DATABASE)
389         os.makedirs(config.DATABASE + '/files')
390         db = anydbm.Database(config, 'test')
391         setupSchema(db, 1, anydbm)
392         self.db = anydbm.Database(config)
393         setupSchema(self.db, 0, anydbm)
394         self.db2 = anydbm.Database(config, 'test')
395         setupSchema(self.db2, 0, anydbm)
397     def xtestExceptions(self):
398         ' make sure exceptions are raised on writes to a read-only db '
399         # this tests the exceptions that should be raised
400         ar = self.assertRaises
402         # this tests the exceptions that should be raised
403         ar(DatabaseError, self.db.status.create, name="foo")
404         ar(DatabaseError, self.db.status.set, '1', name="foo")
405         ar(DatabaseError, self.db.status.retire, '1')
408 class bsddbDBTestCase(anydbmDBTestCase):
409     def setUp(self):
410         from roundup.backends import bsddb
411         # remove previous test, ignore errors
412         if os.path.exists(config.DATABASE):
413             shutil.rmtree(config.DATABASE)
414         os.makedirs(config.DATABASE + '/files')
415         self.db = bsddb.Database(config, 'test')
416         setupSchema(self.db, 1, bsddb)
417         self.db2 = bsddb.Database(config, 'test')
418         setupSchema(self.db2, 0, bsddb)
420 class bsddbReadOnlyDBTestCase(anydbmReadOnlyDBTestCase):
421     def setUp(self):
422         from roundup.backends import bsddb
423         # remove previous test, ignore errors
424         if os.path.exists(config.DATABASE):
425             shutil.rmtree(config.DATABASE)
426         os.makedirs(config.DATABASE + '/files')
427         db = bsddb.Database(config, 'test')
428         setupSchema(db, 1, bsddb)
429         self.db = bsddb.Database(config)
430         setupSchema(self.db, 0, bsddb)
431         self.db2 = bsddb.Database(config, 'test')
432         setupSchema(self.db2, 0, bsddb)
435 class bsddb3DBTestCase(anydbmDBTestCase):
436     def setUp(self):
437         from roundup.backends import bsddb3
438         # remove previous test, ignore errors
439         if os.path.exists(config.DATABASE):
440             shutil.rmtree(config.DATABASE)
441         os.makedirs(config.DATABASE + '/files')
442         self.db = bsddb3.Database(config, 'test')
443         setupSchema(self.db, 1, bsddb3)
444         self.db2 = bsddb3.Database(config, 'test')
445         setupSchema(self.db2, 0, bsddb3)
447 class bsddb3ReadOnlyDBTestCase(anydbmReadOnlyDBTestCase):
448     def setUp(self):
449         from roundup.backends import bsddb3
450         # remove previous test, ignore errors
451         if os.path.exists(config.DATABASE):
452             shutil.rmtree(config.DATABASE)
453         os.makedirs(config.DATABASE + '/files')
454         db = bsddb3.Database(config, 'test')
455         setupSchema(db, 1, bsddb3)
456         self.db = bsddb3.Database(config)
457         setupSchema(self.db, 0, bsddb3)
458         self.db2 = bsddb3.Database(config, 'test')
459         setupSchema(self.db2, 0, bsddb3)
462 class metakitDBTestCase(anydbmDBTestCase):
463     def setUp(self):
464         from roundup.backends import metakit
465         import weakref
466         metakit._instances = weakref.WeakValueDictionary()
467         # remove previous test, ignore errors
468         if os.path.exists(config.DATABASE):
469             shutil.rmtree(config.DATABASE)
470         os.makedirs(config.DATABASE + '/files')
471         self.db = metakit.Database(config, 'test')
472         setupSchema(self.db, 1, metakit)
473         self.db2 = metakit.Database(config, 'test')
474         setupSchema(self.db2, 0, metakit)
476     def xtestTransactions(self):
477         # remember the number of items we started
478         num_issues = len(self.db.issue.list())
479         self.db.issue.create(title="don't commit me!", status='1')
480         self.assertNotEqual(num_issues, len(self.db.issue.list()))
481         self.db.rollback()
482         self.assertEqual(num_issues, len(self.db.issue.list()))
483         self.db.issue.create(title="please commit me!", status='1')
484         self.assertNotEqual(num_issues, len(self.db.issue.list()))
485         self.db.commit()
486         self.assertNotEqual(num_issues, len(self.db.issue.list()))
487         self.db.rollback()
488         self.assertNotEqual(num_issues, len(self.db.issue.list()))
489         self.db.file.create(name="test", type="text/plain", content="hi")
490         self.db.rollback()
491         for i in range(10):
492             self.db.file.create(name="test", type="text/plain", 
493                     content="hi %d"%(i))
494             self.db.commit()
495         # TODO: would be good to be able to ensure the file is not on disk after
496         # a rollback...
497         self.assertNotEqual(num_files, num_files2)
498         self.db.file.create(name="test", type="text/plain", content="hi")
499         self.db.rollback()
501 class metakitReadOnlyDBTestCase(anydbmReadOnlyDBTestCase):
502     def setUp(self):
503         from roundup.backends import metakit
504         import weakref
505         metakit._instances = weakref.WeakValueDictionary()
506         # remove previous test, ignore errors
507         if os.path.exists(config.DATABASE):
508             shutil.rmtree(config.DATABASE)
509         os.makedirs(config.DATABASE + '/files')
510         db = metakit.Database(config, 'test')
511         setupSchema(db, 1, metakit)
512         self.db = metakit.Database(config)
513         setupSchema(self.db, 0, metakit)
514         self.db2 = metakit.Database(config, 'test')
515         setupSchema(self.db2, 0, metakit)
517 def suite():
518     l = [
519          unittest.makeSuite(anydbmDBTestCase, 'test'),
520          unittest.makeSuite(anydbmReadOnlyDBTestCase, 'test')
521     ]
522     return unittest.TestSuite(l)
524     try:
525         import bsddb
526         l.append(unittest.makeSuite(bsddbDBTestCase, 'test'))
527         l.append(unittest.makeSuite(bsddbReadOnlyDBTestCase, 'test'))
528     except:
529         print 'bsddb module not found, skipping bsddb DBTestCase'
531     try:
532         import bsddb3
533         l.append(unittest.makeSuite(bsddb3DBTestCase, 'test'))
534         l.append(unittest.makeSuite(bsddb3ReadOnlyDBTestCase, 'test'))
535     except:
536         print 'bsddb3 module not found, skipping bsddb3 DBTestCase'
538     try:
539         import metakit
540         l.append(unittest.makeSuite(metakitDBTestCase, 'test'))
541         l.append(unittest.makeSuite(metakitReadOnlyDBTestCase, 'test'))
542     except:
543         print 'metakit module not found, skipping metakit DBTestCase'
545     return unittest.TestSuite(l)
548 # $Log: not supported by cvs2svn $
549 # Revision 1.31  2002/07/14 23:17:45  richard
550 # minor change to make testing easier
552 # Revision 1.30  2002/07/14 06:06:34  richard
553 # Did some old TODOs
555 # Revision 1.29  2002/07/14 04:03:15  richard
556 # Implemented a switch to disable journalling for a Class. CGI session
557 # database now uses it.
559 # Revision 1.28  2002/07/14 02:16:29  richard
560 # Fixes for the metakit backend (removed the cut-n-paste IssueClass, removed
561 # a special case for it in testing)
563 # Revision 1.27  2002/07/14 02:05:54  richard
564 # . all storage-specific code (ie. backend) is now implemented by the backends
566 # Revision 1.26  2002/07/11 01:11:03  richard
567 # Added metakit backend to the db tests and fixed the more easily fixable test
568 # failures.
570 # Revision 1.25  2002/07/09 04:19:09  richard
571 # Added reindex command to roundup-admin.
572 # Fixed reindex on first access.
573 # Also fixed reindexing of entries that change.
575 # Revision 1.24  2002/07/09 03:02:53  richard
576 # More indexer work:
577 # - all String properties may now be indexed too. Currently there's a bit of
578 #   "issue" specific code in the actual searching which needs to be
579 #   addressed. In a nutshell:
580 #   + pass 'indexme="yes"' as a String() property initialisation arg, eg:
581 #         file = FileClass(db, "file", name=String(), type=String(),
582 #             comment=String(indexme="yes"))
583 #   + the comment will then be indexed and be searchable, with the results
584 #     related back to the issue that the file is linked to
585 # - as a result of this work, the FileClass has a default MIME type that may
586 #   be overridden in a subclass, or by the use of a "type" property as is
587 #   done in the default templates.
588 # - the regeneration of the indexes (if necessary) is done once the schema is
589 #   set up in the dbinit.
591 # Revision 1.23  2002/06/20 23:51:48  richard
592 # Cleaned up the hyperdb tests
594 # Revision 1.22  2002/05/21 05:52:11  richard
595 # Well whadya know, bsddb3 works again.
596 # The backend is implemented _exactly_ the same as bsddb - so there's no
597 # using its transaction or locking support. It'd be nice to use those some
598 # day I suppose.
600 # Revision 1.21  2002/04/15 23:25:15  richard
601 # . node ids are now generated from a lockable store - no more race conditions
603 # We're using the portalocker code by Jonathan Feinberg that was contributed
604 # to the ASPN Python cookbook. This gives us locking across Unix and Windows.
606 # Revision 1.20  2002/04/03 05:54:31  richard
607 # Fixed serialisation problem by moving the serialisation step out of the
608 # hyperdb.Class (get, set) into the hyperdb.Database.
610 # Also fixed htmltemplate after the showid changes I made yesterday.
612 # Unit tests for all of the above written.
614 # Revision 1.19  2002/02/25 14:34:31  grubert
615 #  . use blobfiles in back_anydbm which is used in back_bsddb.
616 #    change test_db as dirlist does not work for subdirectories.
617 #    ATTENTION: blobfiles now creates subdirectories for files.
619 # Revision 1.18  2002/01/22 07:21:13  richard
620 # . fixed back_bsddb so it passed the journal tests
622 # ... it didn't seem happy using the back_anydbm _open method, which is odd.
623 # Yet another occurrance of whichdb not being able to recognise older bsddb
624 # databases. Yadda yadda. Made the HYPERDBDEBUG stuff more sane in the
625 # process.
627 # Revision 1.17  2002/01/22 05:06:09  rochecompaan
628 # We need to keep the last 'set' entry in the journal to preserve
629 # information on 'activity' for nodes.
631 # Revision 1.16  2002/01/21 16:33:20  rochecompaan
632 # You can now use the roundup-admin tool to pack the database
634 # Revision 1.15  2002/01/19 13:16:04  rochecompaan
635 # Journal entries for link and multilink properties can now be switched on
636 # or off.
638 # Revision 1.14  2002/01/16 07:02:57  richard
639 #  . lots of date/interval related changes:
640 #    - more relaxed date format for input
642 # Revision 1.13  2002/01/14 02:20:15  richard
643 #  . changed all config accesses so they access either the instance or the
644 #    config attriubute on the db. This means that all config is obtained from
645 #    instance_config instead of the mish-mash of classes. This will make
646 #    switching to a ConfigParser setup easier too, I hope.
648 # At a minimum, this makes migration a _little_ easier (a lot easier in the
649 # 0.5.0 switch, I hope!)
651 # Revision 1.12  2001/12/17 03:52:48  richard
652 # Implemented file store rollback. As a bonus, the hyperdb is now capable of
653 # storing more than one file per node - if a property name is supplied,
654 # the file is called designator.property.
655 # I decided not to migrate the existing files stored over to the new naming
656 # scheme - the FileClass just doesn't specify the property name.
658 # Revision 1.11  2001/12/10 23:17:20  richard
659 # Added transaction tests to test_db
661 # Revision 1.10  2001/12/03 21:33:39  richard
662 # Fixes so the tests use commit and not close
664 # Revision 1.9  2001/12/02 05:06:16  richard
665 # . We now use weakrefs in the Classes to keep the database reference, so
666 #   the close() method on the database is no longer needed.
667 #   I bumped the minimum python requirement up to 2.1 accordingly.
668 # . #487480 ] roundup-server
669 # . #487476 ] INSTALL.txt
671 # I also cleaned up the change message / post-edit stuff in the cgi client.
672 # There's now a clearly marked "TODO: append the change note" where I believe
673 # the change note should be added there. The "changes" list will obviously
674 # have to be modified to be a dict of the changes, or somesuch.
676 # More testing needed.
678 # Revision 1.8  2001/10/09 07:25:59  richard
679 # Added the Password property type. See "pydoc roundup.password" for
680 # implementation details. Have updated some of the documentation too.
682 # Revision 1.7  2001/08/29 06:23:59  richard
683 # Disabled the bsddb3 module entirely in the unit testing. See CHANGES for
684 # details.
686 # Revision 1.6  2001/08/07 00:24:43  richard
687 # stupid typo
689 # Revision 1.5  2001/08/07 00:15:51  richard
690 # Added the copyright/license notice to (nearly) all files at request of
691 # Bizar Software.
693 # Revision 1.4  2001/07/30 03:45:56  richard
694 # Added more DB to test_db. Can skip tests where imports fail.
696 # Revision 1.3  2001/07/29 07:01:39  richard
697 # Added vim command to all source so that we don't get no steenkin' tabs :)
699 # Revision 1.2  2001/07/29 04:09:20  richard
700 # Added the fabricated property "id" to all hyperdb classes.
702 # Revision 1.1  2001/07/27 06:55:07  richard
703 # moving tests -> test
705 # Revision 1.7  2001/07/27 06:26:43  richard
706 # oops - wasn't deleting the test dir after the read-only tests
708 # Revision 1.6  2001/07/27 06:23:59  richard
709 # consistency
711 # Revision 1.5  2001/07/27 06:23:09  richard
712 # Added some new hyperdb tests to make sure we raise the right exceptions.
714 # Revision 1.4  2001/07/25 04:34:31  richard
715 # Added id and log to tests files...
718 # vim: set filetype=python ts=4 sw=4 et si