[GRASS-SVN] r62645 - grass/trunk/lib/python/script
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Nov 6 14:10:22 PST 2014
Author: annakrat
Date: 2014-11-06 14:10:22 -0800 (Thu, 06 Nov 2014)
New Revision: 62645
Modified:
grass/trunk/lib/python/script/vector.py
Log:
pythonlib: fix for comment:4:ticket:2431 - object_pairs_hook not implemented in python 2.6, it's needed for using OrderedDict instead of normal dict, but vector_what will still work, only the order in which the results are presented is not defined
Modified: grass/trunk/lib/python/script/vector.py
===================================================================
--- grass/trunk/lib/python/script/vector.py 2014-11-06 22:07:42 UTC (rev 62644)
+++ grass/trunk/lib/python/script/vector.py 2014-11-06 22:10:22 UTC (rev 62645)
@@ -370,11 +370,15 @@
except ImportError:
orderedDict = dict
+ kwargs = {}
if encoding:
- result = json.loads(ret, object_pairs_hook=orderedDict, encoding=encoding)
- else:
- result = json.loads(ret, object_pairs_hook=orderedDict)
+ kwargs['encoding'] = encoding
+ if sys.version_info[0:2] > (2, 6):
+ kwargs['object_pairs_hook'] = orderedDict
+
+ result = json.loads(ret, **kwargs)
+
for vmap in result['Maps']:
cats = vmap.pop('Categories', None)
if cats:
More information about the grass-commit
mailing list