From dec9a00eb2df328493d7ce0b1e141f01a94a4f6d Mon Sep 17 00:00:00 2001 From: richard Date: Fri, 3 Aug 2001 01:28:33 +0000 Subject: [PATCH] Used the much nicer load_package, pointed out by Steve Majewski. git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@199 57a73879-2fb5-44c3-a270-3262357dd7e2 --- cgi-bin/roundup.cgi | 10 +++++++--- roundup-admin | 9 +++++++-- roundup-mailgw | 9 +++++++-- roundup-server | 10 +++++++--- roundup/init.py | 9 +++++++-- 5 files changed, 35 insertions(+), 12 deletions(-) diff --git a/cgi-bin/roundup.cgi b/cgi-bin/roundup.cgi index c1c0c0d..2cf8efa 100755 --- a/cgi-bin/roundup.cgi +++ b/cgi-bin/roundup.cgi @@ -1,5 +1,5 @@ #!/usr/bin/env python -# $Id: roundup.cgi,v 1.6 2001-08-03 00:59:34 richard Exp $ +# $Id: roundup.cgi,v 1.7 2001-08-03 01:28:33 richard Exp $ # python version check import sys @@ -92,8 +92,7 @@ try: os.environ['PATH_INFO'] = string.join(path[2:], '/') if ROUNDUP_INSTANCE_HOMES.has_key(instance): instance_home = ROUNDUP_INSTANCE_HOMES[instance] - instance = imp.load_module('instance', None, instance_home, - ('', '', 5)) + instance = imp.load_package('instance', instance_home) else: raise ValueError, 'No such instance "%s"'%instance main(instance, out) @@ -106,6 +105,11 @@ sys.stdout, sys.stderr = out, err # # $Log: not supported by cvs2svn $ +# Revision 1.6 2001/08/03 00:59:34 richard +# Instance import now imports the instance using imp.load_module so that +# we can have instance homes of "roundup" or other existing python package +# names. +# # Revision 1.5 2001/07/29 07:01:39 richard # Added vim command to all source so that we don't get no steenkin' tabs :) # diff --git a/roundup-admin b/roundup-admin index fbf6cac..47ecd6c 100755 --- a/roundup-admin +++ b/roundup-admin @@ -1,5 +1,5 @@ #! /usr/bin/python -# $Id: roundup-admin,v 1.11 2001-08-03 00:59:34 richard Exp $ +# $Id: roundup-admin,v 1.12 2001-08-03 01:28:33 richard Exp $ import sys if int(sys.version[0]) < 2: @@ -381,7 +381,7 @@ def main(): password = getpass.getpass(' password: ') # get the instance - instance = imp.load_module('instance', None, instance_home, ('', '', 5)) + instance = imp.load_package('instance', instance_home) function = figureCommands().get(command, None) @@ -404,6 +404,11 @@ if __name__ == '__main__': # # $Log: not supported by cvs2svn $ +# Revision 1.11 2001/08/03 00:59:34 richard +# Instance import now imports the instance using imp.load_module so that +# we can have instance homes of "roundup" or other existing python package +# names. +# # Revision 1.10 2001/07/30 08:12:17 richard # Added time logging and file uploading to the templates. # diff --git a/roundup-mailgw b/roundup-mailgw index 94a1d38..f359d5f 100755 --- a/roundup-mailgw +++ b/roundup-mailgw @@ -1,5 +1,5 @@ #! /usr/bin/python -# $Id: roundup-mailgw,v 1.3 2001-08-03 00:59:34 richard Exp $ +# $Id: roundup-mailgw,v 1.4 2001-08-03 01:28:33 richard Exp $ import sys if int(sys.version[0]) < 2: @@ -18,7 +18,7 @@ if not instance_home: # get the instance import imp -instance = imp.load_module('instance', None, instance_home, ('', '', 5)) +instance = imp.load_package('instance', instance_home) # invokde the mail handler db = instance.open('admin') @@ -27,6 +27,11 @@ handler.main(sys.stdin) # # $Log: not supported by cvs2svn $ +# Revision 1.3 2001/08/03 00:59:34 richard +# Instance import now imports the instance using imp.load_module so that +# we can have instance homes of "roundup" or other existing python package +# names. +# # Revision 1.2 2001/07/29 07:01:39 richard # Added vim command to all source so that we don't get no steenkin' tabs :) # diff --git a/roundup-server b/roundup-server index 52f977f..b4688e0 100755 --- a/roundup-server +++ b/roundup-server @@ -3,7 +3,7 @@ Stolen from CGIHTTPServer -$Id: roundup-server,v 1.7 2001-08-03 00:59:34 richard Exp $ +$Id: roundup-server,v 1.8 2001-08-03 01:28:33 richard Exp $ """ import sys @@ -98,8 +98,7 @@ class RoundupRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): instance = urllib.unquote(l_path[1]) if self.ROUNDUP_INSTANCE_HOMES.has_key(instance): instance_home = self.ROUNDUP_INSTANCE_HOMES[instance] - instance = imp.load_module('instance', None, instance_home, - ('', '', 5)) + instance = imp.load_package('instance', instance_home) else: raise ValueError, 'No such instance "%s"'%instance @@ -257,6 +256,11 @@ if __name__ == '__main__': # # $Log: not supported by cvs2svn $ +# Revision 1.7 2001/08/03 00:59:34 richard +# Instance import now imports the instance using imp.load_module so that +# we can have instance homes of "roundup" or other existing python package +# names. +# # Revision 1.6 2001/07/29 07:01:39 richard # Added vim command to all source so that we don't get no steenkin' tabs :) # diff --git a/roundup/init.py b/roundup/init.py index 11b69ba..9d5cba4 100644 --- a/roundup/init.py +++ b/roundup/init.py @@ -1,4 +1,4 @@ -# $Id: init.py,v 1.9 2001-08-03 00:59:34 richard Exp $ +# $Id: init.py,v 1.10 2001-08-03 01:28:33 richard Exp $ import os, shutil, sys, errno, imp @@ -50,11 +50,16 @@ from roundup.backends.back_%s import Database'''%backend open(os.path.join(instance_home, 'select_db.py'), 'w').write(db) # now import the instance and call its init - instance = imp.load_module('instance', None, instance_home, ('', '', 5)) + instance = imp.loa_package('instance', instance_home) instance.init(adminpw) # # $Log: not supported by cvs2svn $ +# Revision 1.9 2001/08/03 00:59:34 richard +# Instance import now imports the instance using imp.load_module so that +# we can have instance homes of "roundup" or other existing python package +# names. +# # Revision 1.8 2001/07/29 07:01:39 richard # Added vim command to all source so that we don't get no steenkin' tabs :) # -- 2.30.2