From a9ac8b7971f3575903fae5aa9065991cb2eeaeab Mon Sep 17 00:00:00 2001 From: schlatterbeck Date: Thu, 21 Oct 2010 19:19:58 +0000 Subject: [PATCH] Fix setting of sys.path when importing schema.py, fixes issue2550675, 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 | 2 ++ doc/acknowledgements.txt | 1 + roundup/instance.py | 10 +++++----- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 1bf1ec1..08dfdb5 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -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) diff --git a/doc/acknowledgements.txt b/doc/acknowledgements.txt index 0a60d63..e523d87 100644 --- a/doc/acknowledgements.txt +++ b/doc/acknowledgements.txt @@ -94,6 +94,7 @@ Ramiro Morales, Toni Mueller, Stefan Niederhauser, Truls E. Næss, +Bryce L Nordgren, Patrick Ohly, Luke Opperman, Eddie Parker, diff --git a/roundup/instance.py b/roundup/instance.py index e9a28e2..4c8a97d 100644 --- a/roundup/instance.py +++ b/roundup/instance.py @@ -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: -- 2.30.2