From 4c01fc5f295ade273683a84335c8c47c414685de Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Thu, 10 Jan 2013 18:08:01 +0200 Subject: Move get_format() outside GsxObject --- gsx.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'gsx.py') diff --git a/gsx.py b/gsx.py index 3a418ca..f100ebc 100755 --- a/gsx.py +++ b/gsx.py @@ -46,6 +46,12 @@ def validate(value, what=None): return (result == what) if what else result +def get_format(locale=LOCALE): + df = open(os.path.join(os.path.dirname(__file__), 'langs.json'), 'r') + data = json.load(df) + + return data[locale] + class GsxObject(object): """ The thing that gets sent to and from GSX @@ -62,11 +68,6 @@ class GsxObject(object): def set_method(self, new_method): self.method = new_method - def get_format(self): - df = open(os.path.join(os.path.dirname(__file__), 'langs.json'), 'r') - data = json.load(df) - return data[LOCALE] - def set_type(self, new_dt): """ Sets the object's primary data type to new_dt @@ -252,7 +253,7 @@ class Repair(GsxObject): def __init__(self, *args, **kwargs): super(Repair, self).__init__() - formats = self.get_format() + formats = get_format() # native date types are not welcome here :) for k, v in kwargs.items(): @@ -273,7 +274,7 @@ class Repair(GsxObject): self.dt.customerAddress = self.data['customerAddress'] self.set_request('ns2:carryInRequestType', 'repairData') result = self.submit('CreateCarryInRepair') - + return result.repairConfirmation def create_cnd(self): -- cgit v1.2.3