diff roundup/instance.py @ 4445:80a9295a60fd

Fix setting of sys.path when importing schema.py, fixes issue2550675, thanks to Bryce L Nordgren for reporting.
author Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
date Thu, 21 Oct 2010 19:19:58 +0000
parents b9eb72f20b4d
children 51aa98cda2cf
line wrap: on
line diff
--- a/roundup/instance.py	Thu Oct 21 08:59:43 2010 +0000
+++ b/roundup/instance.py	Thu Oct 21 19:19:58 2010 +0000
@@ -113,6 +113,9 @@
             'db': backend.Database(self.config, name)
         }
 
+        libdir = os.path.join(self.tracker_home, 'lib')
+        if os.path.isdir(libdir):
+            sys.path.insert(1, libdir)
         if self.optimize:
             # execute preloaded schema object
             exec(self.schema, vars)
@@ -121,9 +124,6 @@
             # use preloaded detectors
             detectors = self.detectors
         else:
-            libdir = os.path.join(self.tracker_home, 'lib')
-            if os.path.isdir(libdir):
-                sys.path.insert(1, libdir)
             # execute the schema file
             self._load_python('schema.py', vars)
             if callable (self.schema_hook):
@@ -132,8 +132,8 @@
             for extension in self.get_extensions('extensions'):
                 extension(self)
             detectors = self.get_extensions('detectors')
-            if libdir in sys.path:
-                sys.path.remove(libdir)
+        if libdir in sys.path:
+            sys.path.remove(libdir)
         db = vars['db']
         # apply the detectors
         for detector in detectors:

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