From e31413d3af7faf45b964b190e467567fca2ec56e Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Fri, 4 Sep 2015 15:53:54 -0400 Subject: Fix very stupid configrc bug. --- cbc/environment.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'cbc/environment.py') diff --git a/cbc/environment.py b/cbc/environment.py index d1b7d12..d0778f0 100644 --- a/cbc/environment.py +++ b/cbc/environment.py @@ -20,7 +20,7 @@ class Environment(object): self.pwd = os.path.abspath(os.curdir) self.pkgdir = None self.rcpath = os.path.expanduser('~/.cbcrc') - self.configrc = None + self.configrc = CBCConfigParser(interpolation=ExtendedInterpolation()) if 'CBC_HOME' in kwargs: self.cbchome = kwargs['CBC_HOME'] @@ -32,7 +32,6 @@ class Environment(object): if os.path.exists(self.rcpath): if os.path.isfile(self.rcpath): - self.configrc = CBCConfigParser(interpolation=ExtendedInterpolation()) self.configrc.read(self.rcpath) if 'settings' in self.configrc.sections(): -- cgit From aca92f0cdc432e755fd6d7617e6e51489d14c733 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 30 Sep 2015 23:00:59 -0400 Subject: Force configrc parsing only if it exists... why is this so hard to remember to do? --- cbc/environment.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'cbc/environment.py') diff --git a/cbc/environment.py b/cbc/environment.py index d0778f0..2603af2 100644 --- a/cbc/environment.py +++ b/cbc/environment.py @@ -30,16 +30,7 @@ class Environment(object): if 'CBC_HOME' in self.environ: self.cbchome = self.environ['CBC_HOME'] - if os.path.exists(self.rcpath): - if os.path.isfile(self.rcpath): - self.configrc.read(self.rcpath) - - if 'settings' in self.configrc.sections(): - if 'path' in self.configrc['settings']: - self.cbchome = self.configrc['settings']['path'] - if not self.cbchome: - raise IncompleteEnv('.cbcrc empty path detected. Check: settings -> path') - + # A few hard-coded defaults pertaining to the seldom-used internal web server self.configrc['cbc_cgi'] = {} self.configrc['cbc_cgi']['local_server'] = 'true' self.configrc['cbc_cgi']['local_port'] = '8888' @@ -47,6 +38,16 @@ class Environment(object): self.configrc['cbc_cgi']['protocol'] = 'http' self.configrc['cbc_cgi']['url'] = '{0}://localhost:{1}'.format(self.configrc['cbc_cgi']['protocol'], self.configrc['cbc_cgi']['local_port']) + if os.path.exists(self.rcpath): + if os.path.isfile(self.rcpath): + self.configrc.read(self.rcpath) + + if 'settings' in self.configrc.sections(): + if 'path' in self.configrc['settings']: + self.cbchome = self.configrc['settings']['path'] + if not self.cbchome: + raise IncompleteEnv('.cbcrc empty path detected. Check: settings -> path') + if self.cbchome is None: raise IncompleteEnv('CBC_HOME is undefined.') -- cgit