Code

Fix setting of sys.path when importing schema.py, fixes issue2550675,
authorschlatterbeck <schlatterbeck@57a73879-2fb5-44c3-a270-3262357dd7e2>
Thu, 21 Oct 2010 19:19:58 +0000 (19:19 +0000)
committerschlatterbeck <schlatterbeck@57a73879-2fb5-44c3-a270-3262357dd7e2>
Thu, 21 Oct 2010 19:19:58 +0000 (19:19 +0000)
thanks to Bryce L Nordgren for reporting.

git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4554 57a73879-2fb5-44c3-a270-3262357dd7e2

CHANGES.txt
doc/acknowledgements.txt
roundup/instance.py

index 1bf1ec1bfcc1a83c7f2ac2e16f5761704ba51407..08dfdb5e34fa46e97078ce2a4309b85287392a6f 100644 (file)
@@ -19,6 +19,8 @@ Fixed:
   see doc/upgrading.txt for how to fix your trackers! (Ralf Schlatterbeck).
 - Some minor typos fixed in doc/customizing.txt (Thanks Ralf Hemmecke).
 - XML-RPC documentation now linked from the docs/index (Bernhard Reiter).
+- Fix setting of sys.path when importing schema.py, fixes issue2550675,
+  thanks to Bryce L Nordgren for reporting.
 
 2010-10-08 1.4.16 (r4541)
 
index 0a60d63ea785de020ff6ffc5d4393663b2114d48..e523d87a5b2f92c955ad8f0037f76a39357f3564 100644 (file)
@@ -94,6 +94,7 @@ Ramiro Morales,
 Toni Mueller,
 Stefan Niederhauser,
 Truls E. Næss,
+Bryce L Nordgren,
 Patrick Ohly,
 Luke Opperman,
 Eddie Parker,
index e9a28e2ed2bd1a89c12cb06c09e7c6140c4b264b..4c8a97dd6ade14c2c6faa17f5a1290c50a88ac26 100644 (file)
@@ -113,6 +113,9 @@ class Tracker:
             '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 @@ class Tracker:
             # 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 @@ class Tracker:
             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: