summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d9d7ba6)
raw | patch | inline | side by side (parent: d9d7ba6)
| author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
| Thu, 20 Feb 2003 07:04:55 +0000 (07:04 +0000) | ||
| committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
| Thu, 20 Feb 2003 07:04:55 +0000 (07:04 +0000) |
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1532 57a73879-2fb5-44c3-a270-3262357dd7e2
| roundup/templates/classic/detectors/__init__.py | patch | blob | history | |
| roundup/templates/minimal/detectors/__init__.py | patch | blob | history |
diff --git a/roundup/templates/classic/detectors/__init__.py b/roundup/templates/classic/detectors/__init__.py
index 83420522556260567e5999cac9acbe048e0e47f0..12ef9674f22e7cecff913484191e80c8d44788f8 100644 (file)
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-#$Id: __init__.py,v 1.6 2002-09-11 21:39:17 richard Exp $
+#$Id: __init__.py,v 1.7 2003-02-20 07:04:55 richard Exp $
+
+import sys, os, imp
def init(db):
''' execute the init functions of all the modules in this directory
'''
- import os, sys
this_dir = os.path.split(__file__)[0]
- try:
- sys.path.insert(0, this_dir)
- for file in os.listdir(this_dir):
- file, ext = os.path.splitext(file)
- if file == '__init__':
- continue
- if ext == '.py':
- module = __import__(file)
- module.init(db)
- finally:
- del sys.path[0]
+ for file in os.listdir(this_dir):
+ path = os.path.join(this_dir, file)
+ name, ext = os.path.splitext(file)
+ if name == '__init__':
+ continue
+ if ext == '.py':
+ module = imp.load_module(name, open(path), file,
+ ('.py', 'r', imp.PY_SOURCE))
+ print (name, open(path), file, module)
+ module.init(db)
# vim: set filetype=python ts=4 sw=4 et si
diff --git a/roundup/templates/minimal/detectors/__init__.py b/roundup/templates/minimal/detectors/__init__.py
index 185c4094a137363462992749eaeb59b583d875ea..9ae5e0683caa29a1a18f684bf4c675fc08d8c5bb 100644 (file)
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-#$Id: __init__.py,v 1.1 2002-09-26 04:15:26 richard Exp $
+#$Id: __init__.py,v 1.2 2003-02-20 07:04:55 richard Exp $
+
+import sys, os, imp
def init(db):
''' execute the init functions of all the modules in this directory
'''
- import os, sys
this_dir = os.path.split(__file__)[0]
- try:
- sys.path.insert(0, this_dir)
- for file in os.listdir(this_dir):
- file, ext = os.path.splitext(file)
- if file == '__init__':
- continue
- if ext == '.py':
- module = __import__(file)
- module.init(db)
- finally:
- del sys.path[0]
+ for file in os.listdir(this_dir):
+ path = os.path.join(this_dir, file)
+ name, ext = os.path.splitext(file)
+ if name == '__init__':
+ continue
+ if ext == '.py':
+ module = imp.load_module(name, open(path), file,
+ ('.py', 'r', imp.PY_SOURCE))
+ print (name, open(path), file, module)
+ module.init(db)
# vim: set filetype=python ts=4 sw=4 et si