Changeset 69809


Ignore:
Timestamp:
Nov 13, 2016, 2:51:53 PM (8 years ago)
Author:
wenzeslaus
Message:

pygrass: 7.0 API now works even without using kwargs for Vector.write(), see #3010

File:
1 edited

Legend:

Unmodified
Added
Removed
  • grass/trunk/lib/python/pygrass/vector/__init__.py

    r69552 r69809  
    180180        """
    181181        self.n_lines += 1
     182        if not isinstance(cat, int) and not isinstance(cat, str):
     183            # likely the case of using 7.0 API
     184            import warnings
     185            warnings.warn("Vector.write(geo_obj, attrs=(...)) is"
     186                          " depreciated, specify cat explicitly",
     187                          DeprecationWarning)
     188            # try to accommodate
     189            attrs = cat
     190            cat = None
    182191        if attrs and cat is None:
     192            # TODO: this does not work as expected when there are
     193            # already features in the map when we opened it
    183194            cat = (self._cats[-1] if self._cats else 0) + 1
    184195
Note: See TracChangeset for help on using the changeset viewer.