diff options
author | Filipp Lepalaan <f@0x00.co> | 2013-01-10 18:08:01 +0200 |
---|---|---|
committer | Filipp Lepalaan <f@0x00.co> | 2013-01-10 18:08:01 +0200 |
commit | 4c01fc5f295ade273683a84335c8c47c414685de (patch) | |
tree | 268f9189eb1888c60d5327727eac8e3d23668c02 | |
parent | 5ae6abdd194193744670e7684e9ce3ad63c3a619 (diff) | |
download | py-gsxws-4c01fc5f295ade273683a84335c8c47c414685de.tar.gz py-gsxws-4c01fc5f295ade273683a84335c8c47c414685de.tar.bz2 py-gsxws-4c01fc5f295ade273683a84335c8c47c414685de.zip |
Move get_format() outside GsxObject
-rwxr-xr-x | gsx.py | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -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): |