summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 47750d3)
raw | patch | inline | side by side (parent: 47750d3)
author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Sun, 5 Aug 2001 07:44:36 +0000 (07:44 +0000) | ||
committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Sun, 5 Aug 2001 07:44:36 +0000 (07:44 +0000) |
module name for the instances on import time.
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@210 57a73879-2fb5-44c3-a270-3262357dd7e2
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@210 57a73879-2fb5-44c3-a270-3262357dd7e2
cgi-bin/roundup.cgi | patch | blob | history | |
roundup-admin | patch | blob | history | |
roundup-mailgw | patch | blob | history | |
roundup-server | patch | blob | history | |
roundup/init.py | patch | blob | history | |
roundup/instance.py | [new file with mode: 0644] | patch | blob |
diff --git a/cgi-bin/roundup.cgi b/cgi-bin/roundup.cgi
index 2cf8efa45c842962062466c50e0048ff8aa6b6a3..4722f7b7e24f87c9626269e7afc27b353d632726 100755 (executable)
--- a/cgi-bin/roundup.cgi
+++ b/cgi-bin/roundup.cgi
#!/usr/bin/env python
-# $Id: roundup.cgi,v 1.7 2001-08-03 01:28:33 richard Exp $
+# $Id: roundup.cgi,v 1.8 2001-08-05 07:43:52 richard Exp $
# python version check
import sys
out, err = sys.stdout, sys.stderr
try:
sys.stdout = sys.stderr = LOG
- import os, string, imp
+ import os, string
+ import roundup.instance
path = string.split(os.environ['PATH_INFO'], '/')
instance = path[1]
os.environ['PATH_INFO'] = string.join(path[2:], '/')
if ROUNDUP_INSTANCE_HOMES.has_key(instance):
instance_home = ROUNDUP_INSTANCE_HOMES[instance]
- instance = imp.load_package('instance', instance_home)
+ instance = roundup.instance.open(instance_home)
else:
raise ValueError, 'No such instance "%s"'%instance
main(instance, out)
#
# $Log: not supported by cvs2svn $
+# Revision 1.7 2001/08/03 01:28:33 richard
+# Used the much nicer load_package, pointed out by Steve Majewski.
+#
# 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
diff --git a/roundup-admin b/roundup-admin
index 47ecd6c4e14e9374901a92578e6ab0957eb5e720..373216541a7270c390d200e6191f94173f643b87 100755 (executable)
--- a/roundup-admin
+++ b/roundup-admin
#! /usr/bin/python
-# $Id: roundup-admin,v 1.12 2001-08-03 01:28:33 richard Exp $
+# $Id: roundup-admin,v 1.13 2001-08-05 07:44:13 richard Exp $
import sys
if int(sys.version[0]) < 2:
print 'Roundup requires python 2.0 or later.'
sys.exit(1)
-import string, os, getpass, getopt, re, imp
+import string, os, getpass, getopt, re
from roundup import date, roundupdb, init
+import roundup.instance
def usage(message=''):
if message: message = 'Problem: '+message+'\n'
password = getpass.getpass(' password: ')
# get the instance
- instance = imp.load_package('instance', instance_home)
+ instance = roundup.instance.open(instance_home)
function = figureCommands().get(command, None)
#
# $Log: not supported by cvs2svn $
+# Revision 1.12 2001/08/03 01:28:33 richard
+# Used the much nicer load_package, pointed out by Steve Majewski.
+#
# 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
diff --git a/roundup-mailgw b/roundup-mailgw
index f359d5fdec7108c78c71fecc6e9b78e3225346d7..f7fd033374710f1a121e48cdb2624806744cf6d7 100755 (executable)
--- a/roundup-mailgw
+++ b/roundup-mailgw
#! /usr/bin/python
-# $Id: roundup-mailgw,v 1.4 2001-08-03 01:28:33 richard Exp $
+# $Id: roundup-mailgw,v 1.5 2001-08-05 07:44:25 richard Exp $
import sys
if int(sys.version[0]) < 2:
sys.exit(1)
# get the instance
-import imp
-instance = imp.load_package('instance', instance_home)
+import roundup.instance
+instance = roundup.instance.open(instance_home)
# invokde the mail handler
db = instance.open('admin')
#
# $Log: not supported by cvs2svn $
+# Revision 1.4 2001/08/03 01:28:33 richard
+# Used the much nicer load_package, pointed out by Steve Majewski.
+#
# 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
diff --git a/roundup-server b/roundup-server
index b4688e0f0e88b9ca5308babacf1dd7b42cee9f5c..9b96638a97f122714b3a0d240ea24bfccb5d6fbc 100755 (executable)
--- a/roundup-server
+++ b/roundup-server
Stolen from CGIHTTPServer
-$Id: roundup-server,v 1.8 2001-08-03 01:28:33 richard Exp $
+$Id: roundup-server,v 1.9 2001-08-05 07:44:36 richard Exp $
"""
import sys
# Roundup modules of use here
from roundup import cgitb, cgi_client
+import roundup.instance
#
## Configuration
instance = urllib.unquote(l_path[1])
if self.ROUNDUP_INSTANCE_HOMES.has_key(instance):
instance_home = self.ROUNDUP_INSTANCE_HOMES[instance]
- instance = imp.load_package('instance', instance_home)
+ instance = roundup.instance.open(instance_home)
else:
raise ValueError, 'No such instance "%s"'%instance
#
# $Log: not supported by cvs2svn $
+# Revision 1.8 2001/08/03 01:28:33 richard
+# Used the much nicer load_package, pointed out by Steve Majewski.
+#
# 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
diff --git a/roundup/init.py b/roundup/init.py
index 1d873d1a549059d88a117ff11402c7082cae048a..837bbcbcbab38060f559a5226c3c2e9c4ea1829c 100644 (file)
--- a/roundup/init.py
+++ b/roundup/init.py
-# $Id: init.py,v 1.11 2001-08-04 22:42:43 richard Exp $
+# $Id: init.py,v 1.12 2001-08-05 07:43:52 richard Exp $
-import os, shutil, sys, errno, imp
+import os, shutil, sys, errno
+
+import roundup.instance
def copytree(src, dst, symlinks=0):
"""Recursively copy a directory tree using copy2().
open(os.path.join(instance_home, 'select_db.py'), 'w').write(db)
# now import the instance and call its init
- instance = imp.load_package('instance', instance_home)
+ instance = roundup.instance.open(instance_home)
instance.init(adminpw)
#
# $Log: not supported by cvs2svn $
+# Revision 1.11 2001/08/04 22:42:43 richard
+# Fixed sf.net bug #447671 - typo
+#
# Revision 1.10 2001/08/03 01:28:33 richard
# Used the much nicer load_package, pointed out by Steve Majewski.
#
diff --git a/roundup/instance.py b/roundup/instance.py
--- /dev/null
+++ b/roundup/instance.py
@@ -0,0 +1,34 @@
+# $Id: instance.py,v 1.1 2001-08-05 07:43:52 richard Exp $
+
+''' Currently this module provides one function: open. This function opens
+an instance.
+'''
+
+import imp
+
+class Opener:
+ def __init__(self):
+ self.number = 0
+ self.instances = {}
+
+ def open(self, instance_home):
+ if self.instances.has_key(instance_home):
+ return imp.load_package(self.instances[instance_home],
+ instance_home)
+ self.number = self.number + 1
+ modname = '_roundup_instance_%s'%self.number
+ self.instances[instance_home] = modname
+ return imp.load_package(modname, instance_home)
+
+opener = Opener()
+open = opener.open
+
+del Opener
+del opener
+
+
+#
+# $Log: not supported by cvs2svn $
+#
+#
+# vim: set filetype=python ts=4 sw=4 et si