diff configmix/config.py @ 251:2a8dcab2de8c

Do not implicitely convert a configuration value to text if the value is the result of just a variable expansion. This is technically a breaking change. But no known client code uses the old behaviour.
author Franz Glasner <fzglas.hg@dom66.de>
date Tue, 07 Jul 2020 22:21:27 +0200
parents ff964825a75a
children eed16a1ec8f3
line wrap: on
line diff
--- a/configmix/config.py	Tue Jul 07 09:27:24 2020 +0200
+++ b/configmix/config.py	Tue Jul 07 22:21:27 2020 +0200
@@ -219,6 +219,12 @@
                 raise
             if varvalue is None:
                 varvalue = u("")
+            #
+            # Dont apply and type conversions to str if the whole `s` is
+            # just one expansion
+            #
+            if (start == 0) and (end + 2 == len(s)):
+                return varvalue
             replaced = s[:start] + u(str(varvalue))
             s = replaced + s[end+2:]
             # don't re-evaluate because `self.getvar_s()` expands already