~ubuntu-branches/ubuntu/oneiric/checkbox/oneiric-proposed

« back to all changes in this revision

Viewing changes to checkbox/lib/config.py

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Manrique, Marc Tardif, Chad A. Davis, Barry Warsaw
  • Date: 2011-07-01 11:37:27 UTC
  • Revision ID: james.westby@ubuntu.com-20110701113727-k4pekmtyr7v2i6le
Tags: 0.12.3
[ Marc Tardif ]
* Only reading CHECKBOX_* environment variables in config (LP: #802458)
* Imported scripts and jobs from Platform Services.

[Chad A. Davis]
* Switch to dh_python2 and debhelper7 (LP: #788514)

[Barry Warsaw]
* Fix checkbox_clean.run() to ignore missing executables, as is the case
  in a fresh checkout.

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
        self._parser = parser
34
34
 
35
35
        for (key, value) in os.environ.iteritems():
36
 
            super(IncludeDict, self).__setitem__(key.lower(), value)
 
36
            if key.startswith("CHECKBOX"):
 
37
                super(IncludeDict, self).__setitem__(key.lower(), value)
37
38
 
38
39
    def __setitem__(self, key, value):
39
40
        if key == "includes":
59
60
                    self._parser.read(path)
60
61
 
61
62
        # Environment has precedence over configuration
62
 
        elif key.upper() not in os.environ:
 
63
        elif not key.startswith("CHECKBOX") or key.upper() not in os.environ:
63
64
            super(IncludeDict, self).__setitem__(key, value)
64
65
 
65
66
 
96
97
        raise AttributeError, name
97
98
 
98
99
    def get(self, name):
99
 
        return os.environ.get(name.upper()) \
100
 
            or os.environ.get(name.lower()) \
101
 
            or super(ConfigDefaults, self).get(name)
 
100
        name_upper = name.upper()
 
101
        if not name_upper.startswith("CHECKBOX") or name_upper not in os.environ:
 
102
            return super(ConfigDefaults, self).get(name)
 
103
        else:
 
104
            return os.environ[name_upper]
102
105
 
103
106
 
104
107
class Config(object):