[GRASS-SVN] r69832 - grass/branches/releasebranch_7_2/lib/python/pygrass/vector
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Nov 15 14:38:39 PST 2016
Author: wenzeslaus
Date: 2016-11-15 14:38:39 -0800 (Tue, 15 Nov 2016)
New Revision: 69832
Modified:
grass/branches/releasebranch_7_2/lib/python/pygrass/vector/__init__.py
Log:
pygrass: 7.0 API now works even without using kwargs for Vector.write(), closes #3010
Modified: grass/branches/releasebranch_7_2/lib/python/pygrass/vector/__init__.py
===================================================================
--- grass/branches/releasebranch_7_2/lib/python/pygrass/vector/__init__.py 2016-11-15 16:41:03 UTC (rev 69831)
+++ grass/branches/releasebranch_7_2/lib/python/pygrass/vector/__init__.py 2016-11-15 22:38:39 UTC (rev 69832)
@@ -179,7 +179,18 @@
"""
self.n_lines += 1
+ if not isinstance(cat, int) and not isinstance(cat, str):
+ # likely the case of using 7.0 API
+ import warnings
+ warnings.warn("Vector.write(geo_obj, attrs=(...)) is"
+ " depreciated, specify cat explicitly",
+ DeprecationWarning)
+ # try to accommodate
+ attrs = cat
+ cat = None
if attrs and cat is None:
+ # TODO: this does not work as expected when there are
+ # already features in the map when we opened it
cat = (self._cats[-1] if self._cats else 0) + 1
if cat is not None and cat not in self._cats:
More information about the grass-commit
mailing list