From: Fred Date: Mon, 4 Mar 2013 09:42:02 +0000 (+0800) Subject: Cannot use reserved keywords when writing to config.php X-Git-Tag: v0.4~46 X-Git-Url: https://git.cameron1729.xyz/?a=commitdiff_plain;h=0e4332eeedcf117b46df678a89e7fb96a5bb2e11;p=mdk.git Cannot use reserved keywords when writing to config.php --- diff --git a/lib/moodle.py b/lib/moodle.py index 8b28a77..86cdea3 100644 --- a/lib/moodle.py +++ b/lib/moodle.py @@ -50,7 +50,19 @@ class Moodle(object): _cos_hasstash = False _cos_oldbranch = None - def __init__(self, path, identifier = None): + _reservedKeywords = [ + 'branch', + 'identifier', + 'installed', + 'integration', + 'maturity', + 'path', + 'release', + 'stablebranch', + 'version' + ] + + def __init__(self, path, identifier=None): self.path = path self.identifier = identifier self.version = {} @@ -64,6 +76,9 @@ class Moodle(object): if not os.path.isfile(configFile): return None + if name in self._reservedKeywords: + raise Exception('Cannot use reserved keywords for settings in config.php') + if type(value) == bool: value = 'true' if value else 'false' elif type(value) != int: