Mercurial > hgrepos > Python > libs > ConfigMix
comparison configmix/config.py @ 487:d7f6f2afcee2
Instead of using u(str(v)) use specialized functions for PY2 and PY3
| author | Franz Glasner <f.glasner@feldmann-mg.com> |
|---|---|
| date | Fri, 17 Dec 2021 16:06:49 +0100 |
| parents | 008b35666a43 |
| children | 298510ec8171 |
comparison
equal
deleted
inserted
replaced
| 486:5a88c514d4e0 | 487:d7f6f2afcee2 |
|---|---|
| 26 from urllib.parse import urlsplit | 26 from urllib.parse import urlsplit |
| 27 except ImportError: | 27 except ImportError: |
| 28 from urlparse import urlsplit | 28 from urlparse import urlsplit |
| 29 | 29 |
| 30 from .variables import lookup_varns, lookup_filter | 30 from .variables import lookup_varns, lookup_filter |
| 31 from .compat import u, uchr, n, PY2 | 31 from .compat import u, uchr, n, str_and_u, PY2 |
| 32 from .constants import REF_NAMESPACE, NONE_FILTER, EMPTY_FILTER | 32 from .constants import REF_NAMESPACE, NONE_FILTER, EMPTY_FILTER |
| 33 | 33 |
| 34 | 34 |
| 35 _MARKER = object() | 35 _MARKER = object() |
| 36 | 36 |
| 697 return varvalue | 697 return varvalue |
| 698 if not varvalue: | 698 if not varvalue: |
| 699 # None and/or empty str are handled equally here | 699 # None and/or empty str are handled equally here |
| 700 pass | 700 pass |
| 701 else: | 701 else: |
| 702 res_append(u(str(varvalue))) | 702 res_append(str_and_u(varvalue)) |
| 703 # don't re-evaluate because `self.getvar_s()` expands already | 703 # don't re-evaluate because `self.getvar_s()` expands already |
| 704 rest = end + 2 | 704 rest = end + 2 |
| 705 start = s.find(self._STARTTOK, rest) | 705 start = s.find(self._STARTTOK, rest) |
| 706 res_append(s[rest:]) | 706 res_append(s[rest:]) |
| 707 return self._EMPTY_STR.join(res) | 707 return self._EMPTY_STR.join(res) |
