diff options
author | Filipp Lepalaan <f@230.to> | 2013-05-13 18:44:29 +0300 |
---|---|---|
committer | Filipp Lepalaan <f@230.to> | 2013-05-13 18:44:29 +0300 |
commit | 5f6da8bfcfd2ad8380815b6b5f309c9985873eb1 (patch) | |
tree | 66372fdce3cc2f7092c2ea7b11411a4f095fe97a /gsxws | |
parent | 59d7edde59e4bc3b4064a1fb3f36eb20393ff646 (diff) | |
download | py-gsxws-5f6da8bfcfd2ad8380815b6b5f309c9985873eb1.tar.gz py-gsxws-5f6da8bfcfd2ad8380815b6b5f309c9985873eb1.tar.bz2 py-gsxws-5f6da8bfcfd2ad8380815b6b5f309c9985873eb1.zip |
More to_xml nesting fixes!
Diffstat (limited to 'gsxws')
-rw-r--r-- | gsxws/core.py | 14 | ||||
-rw-r--r-- | gsxws/products.py | 2 | ||||
-rw-r--r-- | gsxws/repairs.py | 33 |
3 files changed, 19 insertions, 30 deletions
diff --git a/gsxws/core.py b/gsxws/core.py index 59f23dd..c8f9cec 100644 --- a/gsxws/core.py +++ b/gsxws/core.py @@ -336,15 +336,17 @@ class GsxObject(object): """ root = ET.Element(root) for k, v in self._data.items(): - el = ET.SubElement(root, k) - if isinstance(v, basestring): - el.text = v - if isinstance(v, GsxObject): - el.append(v.to_xml(k)) if isinstance(v, list): for e in v: if isinstance(e, GsxObject): - el.append(e.to_xml(k)) + i = ET.SubElement(root, k) + i.extend(e.to_xml(k)) + else: + el = ET.SubElement(root, k) + if isinstance(v, basestring): + el.text = v + if isinstance(v, GsxObject): + el.extend(v.to_xml(k)) return root diff --git a/gsxws/products.py b/gsxws/products.py index f77957d..f51a338 100644 --- a/gsxws/products.py +++ b/gsxws/products.py @@ -83,7 +83,7 @@ class Product(GsxObject): The Fetch iOS Activation Details API is used to fetch activation details of iOS Devices. - >>> Product('013348005376007').get_activation().unlocked + >>> Product('013348005376007').activation().unlocked 'true' >>> Product('W874939YX92').get_activation().unlocked # doctest: +ELLIPSIS Traceback (most recent call last): diff --git a/gsxws/repairs.py b/gsxws/repairs.py index 2a17144..c411174 100644 --- a/gsxws/repairs.py +++ b/gsxws/repairs.py @@ -6,6 +6,15 @@ import logging from core import GsxObject from lookups import Lookup +REPAIR_TYPES = ( + ('CA', "Carry-In/Non-Replinished"), + ('NE', "Return Before Replace"), + ('NT', "No Trouble Found"), + ('ON', "Onsite (Indirect/Direct)"), + ('RR', "Repair Or Replace/Whole Unit Mail-In"), + ('WH', "Mail-In"), +) + class Customer(GsxObject): """ @@ -35,30 +44,8 @@ class RepairOrderLine(GsxObject): class Repair(GsxObject): "Base class for the different GSX Repair types" - notes = "" - symptom = "" - diagnosis = "" - serialNumber = "" - referenceNumber = "" - unitReceivedDate = "" - unitReceivedTime = "" - requestReview = False - customerAddress = None - purchaseOrderNumber = "" - - orderLines = [] - _namespace = "asp:" - TYPES = ( - ('CA', "Carry-In/Non-Replinished"), - ('NE', "Return Before Replace"), - ('NT', "No Trouble Found"), - ('ON', "Onsite (Indirect/Direct)"), - ('RR', "Repair Or Replace/Whole Unit Mail-In"), - ('WH', "Mail-In"), - ) - def __init__(self, number=None, **kwargs): super(Repair, self).__init__(**kwargs) @@ -143,7 +130,7 @@ class Repair(GsxObject): for the submitted repair confirmation number(s). >>> Repair('G135773004').status().repairStatus - 'Closed and Completed' + u'Closed and Completed' """ self.repairConfirmationNumbers = self.dispatchId status = self._submit("RepairStatusRequest", "RepairStatus", "repairStatus")[0] |