From 05551fbdd641d25cc20648afade7e8c78545a341 Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Sat, 20 Jul 2013 22:00:54 +0300 Subject: Return prices correctly --- gsxws/objectify.py | 8 +++----- tests/fixtures/parts_lookup.xml | 2 +- 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 @@ SVC,REMOTE 661-4448 Module - 17.1 + EUR 17.1 17.1 5 661-2549 -- cgit v1.2.3