comparison roundup/instance.py @ 2697:d138df58b0c3

load user interfaces
author Alexander Smishlajev <a1s@users.sourceforge.net>
date Wed, 29 Sep 2004 07:01:44 +0000
parents eb14c12813a0
children 460c07a2dff1
comparison
equal deleted inserted replaced
2696:a5c5a1106e3b 2697:d138df58b0c3
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.21 2004-09-26 13:16:40 a1s Exp $ 18 # $Id: instance.py,v 1.22 2004-09-29 07:01:44 a1s Exp $
19 19
20 '''Tracker handling (open tracker). 20 '''Tracker handling (open tracker).
21 21
22 Backwards compatibility for the old-style "imported" trackers. 22 Backwards compatibility for the old-style "imported" trackers.
23 ''' 23 '''
24 __docformat__ = 'restructuredtext' 24 __docformat__ = 'restructuredtext'
25 25
26 import os 26 import os
27 from roundup import configuration, rlog 27 import types
28 from roundup import configuration, mailgw, rlog
28 from roundup import hyperdb, backends 29 from roundup import hyperdb, backends
30 from roundup.cgi import client
29 31
30 class Vars: 32 class Vars:
31 def __init__(self, vars): 33 def __init__(self, vars):
32 self.__dict__.update(vars) 34 self.__dict__.update(vars)
33 35
62 'db': backend.Database(self.config, name) 64 'db': backend.Database(self.config, name)
63 } 65 }
64 self._load_python('schema.py', vars) 66 self._load_python('schema.py', vars)
65 db = vars['db'] 67 db = vars['db']
66 68
69 self.load_interfaces()
67 self.load_extensions(db, 'detectors') 70 self.load_extensions(db, 'detectors')
68
69 self.load_extensions(self, 'extensions') 71 self.load_extensions(self, 'extensions')
70 72
71 db.post_init() 73 db.post_init()
72 return db 74 return db
75
76 def load_interfaces(self):
77 """load interfaces.py (if any), initialize Client and MailGW attrs"""
78 vars = {}
79 if os.path.isfile(os.path.join(self.tracker_home, 'interfaces.py')):
80 self._load_python('interfaces.py', vars)
81 self.Client = vars.get('Client', client.Client)
82 self.MailGW = vars.get('MailGW', mailgw.MailGW)
73 83
74 def load_extensions(self, parent, dirname): 84 def load_extensions(self, parent, dirname):
75 dirpath = os.path.join(self.tracker_home, dirname) 85 dirpath = os.path.join(self.tracker_home, dirname)
76 if os.path.isdir(dirpath): 86 if os.path.isdir(dirpath):
77 for name in os.listdir(dirpath): 87 for name in os.listdir(dirpath):

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