aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipp Lepalaan <f@230.to>2013-05-13 20:34:53 +0300
committerFilipp Lepalaan <f@230.to>2013-05-13 20:34:53 +0300
commit6d117de2c927b8bdf11fac7421483095dc1393eb (patch)
treede3d67c12ce32d065b9d749805301eb7bd150186
parentc68318820cbb4c060ef31d826b543ba8b3568685 (diff)
downloadpy-gsxws-6d117de2c927b8bdf11fac7421483095dc1393eb.tar.gz
py-gsxws-6d117de2c927b8bdf11fac7421483095dc1393eb.tar.bz2
py-gsxws-6d117de2c927b8bdf11fac7421483095dc1393eb.zip
Some minor tweaks
-rw-r--r--gsxws/core.py12
-rw-r--r--gsxws/products.py2
2 files changed, 8 insertions, 6 deletions
diff --git a/gsxws/core.py b/gsxws/core.py
index c0792f5..a3fa859 100644
--- a/gsxws/core.py
+++ b/gsxws/core.py
@@ -352,7 +352,7 @@ class GsxObject(object):
@classmethod
def from_xml(cls, el):
- "Constructs a GsxObject from XML Element"
+ "Constructs a GsxObject from an XML Element"
obj = GsxObject()
for r in el:
@@ -388,21 +388,21 @@ class GsxObject(object):
v = unicode(v) # "must be unicode, not str"
# convert dates to native Python type
- if re.search('^\d{2}/\d{2}/\d{2}$', v):
+ if re.search(r'^\d{2}/\d{2}/\d{2}$', v):
m, d, y = v.split('/')
v = date(2000+int(y), int(m), int(d)).isoformat()
# strip currency prefix and munge into float
- if re.search('Price$', k):
- v = float(re.sub('[A-Z ,]', '', v))
+ if re.search(r'Price$', k):
+ v = float(re.sub(r'[A-Z ,]', '', v))
# Convert timestamps to native Python type
# 18-Jan-13 14:38:04
- if re.search('TimeStamp$', k):
+ if re.search(r'TimeStamp$', k):
v = datetime.strptime(v, '%d-%b-%y %H:%M:%S')
# convert Y and N to corresponding boolean
- if re.search('^[YN]$', k):
+ if re.search(r'^[YN]$', k):
v = (v == 'Y')
setattr(obj, k, v)
diff --git a/gsxws/products.py b/gsxws/products.py
index f51a338..b400ce7 100644
--- a/gsxws/products.py
+++ b/gsxws/products.py
@@ -39,6 +39,8 @@ class Product(GsxObject):
>>> Product('DGKFL06JDHJP').warranty().warrantyStatus
u'Out Of Warranty (No Coverage)'
+ >>> Product('DGKFL06JDHJP').warranty().estimatedPurchaseDate
+ '2011-06-02'
"""
self._submit("unitDetail", "WarrantyStatus", "warrantyDetailInfo")
self.warrantyDetails = self._req.objects[0]