[GRASS-dev] [GRASS-SVN] r68180 - grass/trunk/lib/python/script
Martin Landa
landa.martin at gmail.com
Tue Mar 29 00:16:58 PDT 2016
Ciao,
2016-03-29 8:29 GMT+02:00 <svn_grass at osgeo.org>:
> Author: zarch
> Date: 2016-03-28 23:29:14 -0700 (Mon, 28 Mar 2016)
> New Revision: 68180
>
> Modified:
> grass/trunk/lib/python/script/utils.py
> Log:
> script.utils: fix bug in decode/encode function
candidate for backport? Ma
>
> Modified: grass/trunk/lib/python/script/utils.py
> ===================================================================
> --- grass/trunk/lib/python/script/utils.py 2016-03-29 06:24:03 UTC (rev 68179)
> +++ grass/trunk/lib/python/script/utils.py 2016-03-29 06:29:14 UTC (rev 68180)
> @@ -156,10 +156,8 @@
> :param str string: the string to decode
> """
> enc = locale.getdefaultlocale()[1]
> - if enc:
> - if hasattr(string, 'decode'):
> - return string.decode(enc)
> -
> + if hasattr(string, 'decode'):
> + return string.decode(enc) if enc else string.decode()
> return string
>
>
> @@ -169,10 +167,8 @@
> :param str string: the string to encode
> """
> enc = locale.getdefaultlocale()[1]
> - if enc:
> - if hasattr(string, 'encode'):
> - return string.encode(enc)
> -
> + if hasattr(string, 'encode'):
> + return string.encode(enc) if enc else string.encode()
> return string
>
>
> @@ -376,5 +372,5 @@
> pathname = os.path.join(modulename, dirname) if dirname else modulename
> raise ImportError("Not able to find the path '%s' directory "
> "(current dir '%s')." % (pathname, os.getcwd()))
> -
> +
> sys.path.insert(0, path)
>
> _______________________________________________
> grass-commit mailing list
> grass-commit at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-commit
--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa
More information about the grass-dev
mailing list