aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gsxws/objectify.py8
-rw-r--r--tests/fixtures/parts_lookup.xml2
2 files changed, 4 insertions, 6 deletions
diff --git a/gsxws/objectify.py b/gsxws/objectify.py
index 43d6426..a1856d9 100644
--- a/gsxws/objectify.py
+++ b/gsxws/objectify.py
@@ -51,10 +51,8 @@ def gsx_boolean(value):
return value == 'Y' or value == 'true'
-class GsxPriceElement():
- @property
- def pyval(self):
- return float(re.sub(r'[A-Z ,]', '', self.text))
+def gsx_price(value):
+ return float(re.sub(r'[A-Z ,]', '', value))
def gsx_attachment(value):
@@ -97,7 +95,7 @@ class GsxElement(objectify.ObjectifiedElement):
if name in BASE64_TYPES:
return gsx_attachment(result)
if name in FLOAT_TYPES:
- return GsxPriceElement
+ return gsx_price(result)
if re.search(r'Date$', name):
return gsx_date(result)
if re.search(r'^[YN]$', result):
diff --git a/tests/fixtures/parts_lookup.xml b/tests/fixtures/parts_lookup.xml
index c1ffcb6..11f962d 100644
--- a/tests/fixtures/parts_lookup.xml
+++ b/tests/fixtures/parts_lookup.xml
@@ -12,7 +12,7 @@
<partDescription>SVC,REMOTE</partDescription>
<partNumber>661-4448</partNumber>
<partType>Module</partType>
- <stockPrice>17.1</stockPrice>
+ <stockPrice>EUR 17.1</stockPrice>
<stockPrice>17.1</stockPrice>
<componentCode>5</componentCode>
<originalPartNumber>661-2549</originalPartNumber>