aboutsummaryrefslogtreecommitdiffstats
path: root/gsxws.py
diff options
context:
space:
mode:
authorFilipp Lepalaan <f@230.to>2013-02-12 18:03:43 +0200
committerFilipp Lepalaan <f@230.to>2013-02-12 18:03:43 +0200
commit96b86337a32098d5c320b76c9505f40995d4e385 (patch)
tree390f13fd513bb33350e58d06a10b7786fb61fed1 /gsxws.py
parent8407948f622c3434373fbd9884a6706a3c904577 (diff)
downloadpy-gsxws-96b86337a32098d5c320b76c9505f40995d4e385.tar.gz
py-gsxws-96b86337a32098d5c320b76c9505f40995d4e385.tar.bz2
py-gsxws-96b86337a32098d5c320b76c9505f40995d4e385.zip
Coerce boolean to and from Y/N
Diffstat (limited to 'gsxws.py')
-rwxr-xr-xgsxws.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/gsxws.py b/gsxws.py
index 740000a..4116fd9 100755
--- a/gsxws.py
+++ b/gsxws.py
@@ -264,6 +264,10 @@ class GsxResponse(dict):
if re.search('TimeStamp$', k):
v = datetime.strptime(v, '%d-%b-%y %H:%M:%S')
+ # convert Y and N to corresponding boolean
+ if re.search('^[YN]$', k):
+ v = (v == 'Y')
+
nodedict[k] = v
return nodedict
@@ -441,12 +445,14 @@ class Repair(GsxObject):
super(Repair, self).__init__(*args, **kwargs)
formats = get_format()
- # native date types are not welcome here :)
+ # native types are not welcome here :)
for k, v in kwargs.items():
if isinstance(v, date):
kwargs[k] = v.strftime(formats['df'])
if isinstance(v, time):
kwargs[k] = v.strftime(formats['tf'])
+ if isinstance(v, bool):
+ kwargs[k] = 'Y' if v else 'N'
self.data = kwargs
@@ -457,6 +463,7 @@ class Repair(GsxObject):
"""
dt = self._make_type('ns2:carryInRequestType')
dt.repairData = self.data
+
result = CLIENT.service.CreateCarryInRepair(dt)
return result.repairConfirmation
@@ -689,6 +696,7 @@ if __name__ == '__main__':
#f = 'tests/update_escalation.json'
fp = open(f, 'r')
data = json.load(fp)
+ data['requestReviewByApple'] = False
rep = Repair(**data)
print rep.create_carryin()