From 6d117de2c927b8bdf11fac7421483095dc1393eb Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Mon, 13 May 2013 20:34:53 +0300 Subject: Some minor tweaks --- gsxws/core.py | 12 ++++++------ gsxws/products.py | 2 ++ 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] -- cgit v1.2.3