comparison roundup/instance.py @ 1174:8e318dfaf479

Verify contents of tracker module when the tracker is opened Performance improvements in *dbm and sq backends New benchmark module. To use: PYTHONPATH=. python2 test/benchmark.py (yes, it's a little basic at present ;)
author Richard Jones <richard@users.sourceforge.net>
date Fri, 20 Sep 2002 01:20:32 +0000
parents 86d41c31f9be
children d2801a2b0a77 c4968040459e
comparison
equal deleted inserted replaced
1173:58f1a2c174ed 1174:8e318dfaf479
13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 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" 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, 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
17 # 17 #
18 # $Id: instance.py,v 1.8 2002-09-18 00:02:13 richard Exp $ 18 # $Id: instance.py,v 1.9 2002-09-20 01:20:31 richard Exp $
19 19
20 __doc__ = ''' 20 __doc__ = '''
21 Tracker handling (open tracker). 21 Tracker handling (open tracker).
22 22
23 Currently this module provides one function: open. This function opens 23 Currently this module provides one function: open. This function opens
37 def open(self, tracker_home): 37 def open(self, tracker_home):
38 ''' Open the tracker. 38 ''' Open the tracker.
39 39
40 Raise ValueError if the tracker home doesn't exist. 40 Raise ValueError if the tracker home doesn't exist.
41 ''' 41 '''
42 # sanity check existence of tracker home
42 if not os.path.exists(tracker_home): 43 if not os.path.exists(tracker_home):
43 raise ValueError, 'no such directory: "%s"'%tracker_home 44 raise ValueError, 'no such directory: "%s"'%tracker_home
45
46 # sanity check tracker home contents
47 for reqd in 'config dbinit select_db interfaces'.split():
48 if not os.path.exists(os.path.join(tracker_home, '%s.py'%reqd)):
49 raise TrackerError, 'File "%s.py" missing from tracker '\
50 'home "%s"'%(reqd, tracker_home)
51
44 if self.trackers.has_key(tracker_home): 52 if self.trackers.has_key(tracker_home):
45 return imp.load_package(self.trackers[tracker_home], 53 return imp.load_package(self.trackers[tracker_home],
46 tracker_home) 54 tracker_home)
47 self.number = self.number + 1 55 self.number = self.number + 1
48 modname = '_roundup_tracker_%s'%self.number 56 modname = '_roundup_tracker_%s'%self.number
52 tracker = imp.load_package(modname, tracker_home) 60 tracker = imp.load_package(modname, tracker_home)
53 61
54 # ensure the tracker has all the required bits 62 # ensure the tracker has all the required bits
55 for required in 'config open init Client MailGW'.split(): 63 for required in 'config open init Client MailGW'.split():
56 if not hasattr(tracker, required): 64 if not hasattr(tracker, required):
57 raise TrackerError, 'Required tracker attribute "%s" '\ 65 raise TrackerError, \
58 'missing'%required 66 'Required tracker attribute "%s" missing'%required
59 67
60 return tracker 68 return tracker
61 69
62 opener = Opener() 70 opener = Opener()
63 open = opener.open 71 open = opener.open

Roundup Issue Tracker: http://roundup-tracker.org/