From f327752947ec4ce9445fcf51baddc9ca72443152 Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Mon, 10 Jun 2013 14:32:12 +0300 Subject: Cleanup --- gsxws/comptia.py | 2 +- gsxws/core.py | 2 ++ gsxws/diagnostics.py | 5 ++++- gsxws/orders.py | 5 +++-- gsxws/repairs.py | 16 +++++++--------- 5 files changed, 17 insertions(+), 13 deletions(-) diff --git a/gsxws/comptia.py b/gsxws/comptia.py index 532f2f4..5502cae 100644 --- a/gsxws/comptia.py +++ b/gsxws/comptia.py @@ -60,7 +60,7 @@ class CompTIA(GsxObject): if self._cache.get(): return self._cache.get() - root = self._req.objects[0] + root = self._req.objects for el in root.findall(".//comptiaGroup"): group = {} diff --git a/gsxws/core.py b/gsxws/core.py index 4dd50e5..6f104b1 100644 --- a/gsxws/core.py +++ b/gsxws/core.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + """ Copyright (c) 2013, Filipp Lepalaan All rights reserved. diff --git a/gsxws/diagnostics.py b/gsxws/diagnostics.py index 38326da..d2a9696 100644 --- a/gsxws/diagnostics.py +++ b/gsxws/diagnostics.py @@ -1,8 +1,11 @@ +# -*- coding: utf-8 -*- + from core import GsxObject class Diagnostics(GsxObject): _namespace = "glob:" + def fetch(self): """ The Fetch Repair Diagnostics API allows the service providers/depot/carriers @@ -17,7 +20,7 @@ class Diagnostics(GsxObject): else: self._submit("lookupRequestData", "FetchRepairDiagnostic", "FetchRepairDiagnosticResponse") - return self._req.objects[0] + return self._req.objects def events(self): """ diff --git a/gsxws/orders.py b/gsxws/orders.py index 2421f93..c06a073 100644 --- a/gsxws/orders.py +++ b/gsxws/orders.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + from core import GsxObject @@ -54,8 +56,7 @@ class StockingOrder(GsxObject): return self def submit(self): - self._submit("orderData", "CreateStockingOrder", "orderConfirmation") - return self._req.objects[0] + return self._submit("orderData", "CreateStockingOrder", "orderConfirmation") if __name__ == '__main__': diff --git a/gsxws/repairs.py b/gsxws/repairs.py index ee649d8..13bf4e5 100644 --- a/gsxws/repairs.py +++ b/gsxws/repairs.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + "gsxws/repairs.py" import re import sys @@ -82,8 +84,7 @@ class Repair(GsxObject): if hasattr(self, "dispatchId"): self.repairConfirmationNumber = self.dispatchId - self._submit("repairData", "UpdateSerialNumber", "repairConfirmation") - return self._req.objects[0] + return self._submit("repairData", "UpdateSerialNumber", "repairConfirmation") def update_kgb_sn(self, sn): """ @@ -102,10 +103,8 @@ class Repair(GsxObject): self.serialNumber = sn self.repairConfirmationNumber = self.dispatchId - self._submit("UpdateKGBSerialNumberRequest", "UpdateKGBSerialNumber", - "UpdateKGBSerialNumberResponse") - - return self._req.objects[0] + return self._submit("UpdateKGBSerialNumberRequest", "UpdateKGBSerialNumber", + "UpdateKGBSerialNumberResponse") def lookup(self): """ @@ -136,9 +135,8 @@ class Repair(GsxObject): repair confirmation numbers to be submitted to GSX to be marked as complete. """ self.repairConfirmationNumbers = numbers or self.dispatchId - self._submit("MarkRepairCompleteRequest", "MarkRepairComplete", - "MarkRepairCompleteResponse") - return self._req.objects[0] + return self._submit("MarkRepairCompleteRequest", "MarkRepairComplete", + "MarkRepairCompleteResponse") def status(self, numbers=None): """ -- cgit v1.2.3