Skip to content

Commit

Permalink
moa show now shows if a variable is defined by a parent (recursively) [
Browse files Browse the repository at this point in the history
…#19 state:resolved]
  • Loading branch information
Mark Fiers committed Apr 28, 2011
1 parent 6d7a39c commit 2753b71
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
12 changes: 10 additions & 2 deletions lib/python/moa/jobConf.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

# Copyright 2009-2011 Mark Fiers
# The New Zealand Institute for Plant & Food Research
#
Expand Down Expand Up @@ -78,7 +79,8 @@ def save(self):
self.localConf.save(self.jobConfFile, self.doNotSave)

def setInJobConf(self, key):
if self.jobConf.has_key(key):
c = self._get_conf(key)
if c.has_key(key):
return True
else:
return False
Expand All @@ -101,7 +103,13 @@ def _get_conf(self, key):
return self.jobConf
else:
return self.localConf


def is_local(self, key):
if self.localConf.has_key(key):
return True
else:
return False

def has_key(self, key):
c = self._get_conf(key)
if c.has_key(key):
Expand Down
14 changes: 10 additions & 4 deletions lib/python/moa/plugin/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,21 @@ def configShow(job):
if job.template.parameters[p].private == True:
continue

isLocal = job.conf.is_local(p)

if job.conf.setInJobConf(p):
moa.ui.fprint("{{bold}}%s\t%s{{reset}}" % (
p, job.conf[p]), f='jinja')
if not isLocal:
moa.ui.fprint("%s\t{{bold}}{{magenta}}%s{{reset}}\t(recursively defined)" % (
p, job.conf[p]), f='jinja')
else:
moa.ui.fprint("%s\t{{bold}}%s{{reset}}" % (
p, job.conf[p]), f='jinja')
else:
if job.template.parameters[p].optional:
moa.ui.fprint("{{blue}}%s\t%s{{reset}}" % (
moa.ui.fprint("%s\t{{blue}}%s{{reset}}" % (
p, job.conf[p]), f='jinja')
else:
moa.ui.fprint("{{red}}%s\t%s{{reset}}" % (
moa.ui.fprint("%s\t{{red}}{{bold}}\t(undefined) %s{{reset}}" % (
p, job.conf[p]), f='jinja')

def _unsetCallback(wd, vars):
Expand Down

0 comments on commit 2753b71

Please sign in to comment.