aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipp Lepalaan <f@230.to>2013-03-29 13:00:36 +0200
committerFilipp Lepalaan <f@230.to>2013-03-29 13:00:36 +0200
commit672b4328f16e81dbd55f8a84fbe66c0f9bf57dce (patch)
treefb11c104d2e0a50ec387fd3df45918b7c4a2998e
parent2a1a80dbb6e730f43a0fac2cac5208ce74ecb5a1 (diff)
downloadpy-gsxws-672b4328f16e81dbd55f8a84fbe66c0f9bf57dce.tar.gz
py-gsxws-672b4328f16e81dbd55f8a84fbe66c0f9bf57dce.tar.bz2
py-gsxws-672b4328f16e81dbd55f8a84fbe66c0f9bf57dce.zip
Comptia.fetch() updates local data
-rwxr-xr-xgsxws.py14
1 files changed, 3 insertions, 11 deletions
diff --git a/gsxws.py b/gsxws.py
index 888838d..595b433 100755
--- a/gsxws.py
+++ b/gsxws.py
@@ -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']