From 0b2ab0ee81ea9028a8bf0da809d586e36664ec1e Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Wed, 15 May 2013 12:09:18 +0300 Subject: Dont' set empty values in from_xml() --- gsxws/core.py | 4 ++++ gsxws/orders.py | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gsxws/core.py b/gsxws/core.py index 9eed125..ccaf16b 100644 --- a/gsxws/core.py +++ b/gsxws/core.py @@ -357,6 +357,7 @@ class GsxObject(object): obj = GsxObject() for r in el: + newitem = cls.from_xml(r) k, v = r.tag, r.text @@ -386,6 +387,9 @@ class GsxObject(object): if isinstance(v, basestring): + if v == "": + continue # Don't set empty values at all... + v = unicode(v) # "must be unicode, not str" # convert dates to native Python type diff --git a/gsxws/orders.py b/gsxws/orders.py index 791fe58..cc1f422 100644 --- a/gsxws/orders.py +++ b/gsxws/orders.py @@ -34,7 +34,8 @@ class StockingOrder(GsxObject): self.orderLines = list() def add_part(self, part_number, quantity): - self.orderLines.append(OrderLine(partNumber=part_number, quantity=quantity)) + part = OrderLine(partNumber=part_number, quantity=quantity) + self.orderLines.append(part) return self def submit(self): -- cgit v1.2.3