diff options
author | Filipp Lepalaan <f@230.to> | 2013-03-29 13:00:36 +0200 |
---|---|---|
committer | Filipp Lepalaan <f@230.to> | 2013-03-29 13:00:36 +0200 |
commit | 672b4328f16e81dbd55f8a84fbe66c0f9bf57dce (patch) | |
tree | fb11c104d2e0a50ec387fd3df45918b7c4a2998e | |
parent | 2a1a80dbb6e730f43a0fac2cac5208ce74ecb5a1 (diff) | |
download | py-gsxws-672b4328f16e81dbd55f8a84fbe66c0f9bf57dce.tar.gz py-gsxws-672b4328f16e81dbd55f8a84fbe66c0f9bf57dce.tar.bz2 py-gsxws-672b4328f16e81dbd55f8a84fbe66c0f9bf57dce.zip |
Comptia.fetch() updates local data
-rwxr-xr-x | gsxws.py | 14 |
1 files changed, 3 insertions, 11 deletions
@@ -212,14 +212,6 @@ class CompTIA: def __init__(self): df = open(os.path.join(os.path.dirname(__file__), 'comptia.json')) self.data = json.load(df) - self.groups = dict() - self.modifiers = dict() - - def __getattr__(self, name): - try: - return self.groups[name] - except KeyError, e: - raise e('Unknown component code: %s' % name) def fetch(self): ''' @@ -248,13 +240,13 @@ class CompTIA: for ci in el.findall('comptiaCodeInfo'): group['codes'][ci[0].text] = ci[1].text - self.groups[comp_id] = group + self.data['groups'][comp_id] = group for el in root.findall('.//comptiaModifier'): descr, code = list(el) - self.modifiers[code.text] = descr.text + self.data['modifiers'][code.text] = descr.text - return self.groups + return self.data['groups'] def symptoms(self, component=None): symptoms = self.data['symptoms'] |