Skip to content

Commit 294e4ce

Browse files
author
Richard Jones
committed
Used the much nicer load_package, pointed out by Steve Majewski.
1 parent b204f9f commit 294e4ce

File tree

5 files changed

+35
-12
lines changed

5 files changed

+35
-12
lines changed

cgi-bin/roundup.cgi

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python
2-
# $Id: roundup.cgi,v 1.6 2001-08-03 00:59:34 richard Exp $
2+
# $Id: roundup.cgi,v 1.7 2001-08-03 01:28:33 richard Exp $
33

44
# python version check
55
import sys
@@ -92,8 +92,7 @@ try:
9292
os.environ['PATH_INFO'] = string.join(path[2:], '/')
9393
if ROUNDUP_INSTANCE_HOMES.has_key(instance):
9494
instance_home = ROUNDUP_INSTANCE_HOMES[instance]
95-
instance = imp.load_module('instance', None, instance_home,
96-
('', '', 5))
95+
instance = imp.load_package('instance', instance_home)
9796
else:
9897
raise ValueError, 'No such instance "%s"'%instance
9998
main(instance, out)
@@ -106,6 +105,11 @@ sys.stdout, sys.stderr = out, err
106105

107106
#
108107
# $Log: not supported by cvs2svn $
108+
# Revision 1.6 2001/08/03 00:59:34 richard
109+
# Instance import now imports the instance using imp.load_module so that
110+
# we can have instance homes of "roundup" or other existing python package
111+
# names.
112+
#
109113
# Revision 1.5 2001/07/29 07:01:39 richard
110114
# Added vim command to all source so that we don't get no steenkin' tabs :)
111115
#

roundup-admin

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#! /usr/bin/python
2-
# $Id: roundup-admin,v 1.11 2001-08-03 00:59:34 richard Exp $
2+
# $Id: roundup-admin,v 1.12 2001-08-03 01:28:33 richard Exp $
33

44
import sys
55
if int(sys.version[0]) < 2:
@@ -381,7 +381,7 @@ def main():
381381
password = getpass.getpass(' password: ')
382382

383383
# get the instance
384-
instance = imp.load_module('instance', None, instance_home, ('', '', 5))
384+
instance = imp.load_package('instance', instance_home)
385385

386386
function = figureCommands().get(command, None)
387387

@@ -404,6 +404,11 @@ if __name__ == '__main__':
404404

405405
#
406406
# $Log: not supported by cvs2svn $
407+
# Revision 1.11 2001/08/03 00:59:34 richard
408+
# Instance import now imports the instance using imp.load_module so that
409+
# we can have instance homes of "roundup" or other existing python package
410+
# names.
411+
#
407412
# Revision 1.10 2001/07/30 08:12:17 richard
408413
# Added time logging and file uploading to the templates.
409414
#

roundup-mailgw

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#! /usr/bin/python
2-
# $Id: roundup-mailgw,v 1.3 2001-08-03 00:59:34 richard Exp $
2+
# $Id: roundup-mailgw,v 1.4 2001-08-03 01:28:33 richard Exp $
33

44
import sys
55
if int(sys.version[0]) < 2:
@@ -18,7 +18,7 @@ if not instance_home:
1818

1919
# get the instance
2020
import imp
21-
instance = imp.load_module('instance', None, instance_home, ('', '', 5))
21+
instance = imp.load_package('instance', instance_home)
2222

2323
# invokde the mail handler
2424
db = instance.open('admin')
@@ -27,6 +27,11 @@ handler.main(sys.stdin)
2727

2828
#
2929
# $Log: not supported by cvs2svn $
30+
# Revision 1.3 2001/08/03 00:59:34 richard
31+
# Instance import now imports the instance using imp.load_module so that
32+
# we can have instance homes of "roundup" or other existing python package
33+
# names.
34+
#
3035
# Revision 1.2 2001/07/29 07:01:39 richard
3136
# Added vim command to all source so that we don't get no steenkin' tabs :)
3237
#

roundup-server

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
44
Stolen from CGIHTTPServer
55
6-
$Id: roundup-server,v 1.7 2001-08-03 00:59:34 richard Exp $
6+
$Id: roundup-server,v 1.8 2001-08-03 01:28:33 richard Exp $
77
88
"""
99
import sys
@@ -98,8 +98,7 @@ class RoundupRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
9898
instance = urllib.unquote(l_path[1])
9999
if self.ROUNDUP_INSTANCE_HOMES.has_key(instance):
100100
instance_home = self.ROUNDUP_INSTANCE_HOMES[instance]
101-
instance = imp.load_module('instance', None, instance_home,
102-
('', '', 5))
101+
instance = imp.load_package('instance', instance_home)
103102
else:
104103
raise ValueError, 'No such instance "%s"'%instance
105104

@@ -257,6 +256,11 @@ if __name__ == '__main__':
257256

258257
#
259258
# $Log: not supported by cvs2svn $
259+
# Revision 1.7 2001/08/03 00:59:34 richard
260+
# Instance import now imports the instance using imp.load_module so that
261+
# we can have instance homes of "roundup" or other existing python package
262+
# names.
263+
#
260264
# Revision 1.6 2001/07/29 07:01:39 richard
261265
# Added vim command to all source so that we don't get no steenkin' tabs :)
262266
#

roundup/init.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: init.py,v 1.9 2001-08-03 00:59:34 richard Exp $
1+
# $Id: init.py,v 1.10 2001-08-03 01:28:33 richard Exp $
22

33
import os, shutil, sys, errno, imp
44

@@ -50,11 +50,16 @@ def init(instance_home, template, backend, adminpw):
5050
open(os.path.join(instance_home, 'select_db.py'), 'w').write(db)
5151

5252
# now import the instance and call its init
53-
instance = imp.load_module('instance', None, instance_home, ('', '', 5))
53+
instance = imp.loa_package('instance', instance_home)
5454
instance.init(adminpw)
5555

5656
#
5757
# $Log: not supported by cvs2svn $
58+
# Revision 1.9 2001/08/03 00:59:34 richard
59+
# Instance import now imports the instance using imp.load_module so that
60+
# we can have instance homes of "roundup" or other existing python package
61+
# names.
62+
#
5863
# Revision 1.8 2001/07/29 07:01:39 richard
5964
# Added vim command to all source so that we don't get no steenkin' tabs :)
6065
#

0 commit comments

Comments
 (0)