aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipp Lepalaan <f@230.to>2013-02-28 17:36:20 +0200
committerFilipp Lepalaan <f@230.to>2013-02-28 17:36:20 +0200
commit085ee8e88d326bcd3bdfe054e2c9575a15f781ad (patch)
treedb9621ed44f503586306ed841695088df0903e47
parentd7f0eee0cd03cae8a705e313dd4d41b4768733e8 (diff)
downloadpy-gsxws-085ee8e88d326bcd3bdfe054e2c9575a15f781ad.tar.gz
py-gsxws-085ee8e88d326bcd3bdfe054e2c9575a15f781ad.tar.bz2
py-gsxws-085ee8e88d326bcd3bdfe054e2c9575a15f781ad.zip
Return CompTIA mods and symptoms as two-tuple lists for use with Django forms
-rw-r--r--README.md4
-rwxr-xr-xgsxws.py18
2 files changed, 17 insertions, 5 deletions
diff --git a/README.md b/README.md
index ea6ebf7..6a9df31 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,9 @@
-py-gsx
+py-gsxws
======
Installation:
- pip install -e git+git://github.com/filipp/py-gsx.git#egg=py-gs
+ pip install -e git+git://github.com/filipp/py-gsxws.git#egg=py-gs
It goes a little something like this:
diff --git a/gsxws.py b/gsxws.py
index 41be0ce..813cdd3 100755
--- a/gsxws.py
+++ b/gsxws.py
@@ -164,7 +164,7 @@ class GsxObject(object):
return rd
-class CompTia:
+class CompTIA:
"""
Stores and accesses CompTIA codes.
"""
@@ -211,10 +211,22 @@ class CompTia:
def symptoms(self, component=None):
symptoms = self.data['symptoms']
- return symptoms[component] if component else symptoms
+
+ if component:
+ r = list()
+ for k, v in symptoms[component].items():
+ r.append((k, v))
+ return r
+
+ return symptoms
def modifiers(self):
- return self.data['modifiers']
+ modifiers = list()
+
+ for k, v in self.data['modifiers'].items():
+ modifiers.append((k, v))
+
+ return modifiers
class GsxResponse(dict):
"""