Cast refs to string when assembling a string
RefValue preserves the type of the referenced value only if it's not
embedded in a string. If the referenced value is embedded in a string,
it must be cast to a string before appending.
Signed-off-by: martin f. krafft <madduck@madduck.net>
diff --git a/reclass/utils/refvalue.py b/reclass/utils/refvalue.py
index 88dc998..91d7c0e 100644
--- a/reclass/utils/refvalue.py
+++ b/reclass/utils/refvalue.py
@@ -96,10 +96,10 @@
# preserve the type of the referenced variable
return resolver(self._refs[0])
- # reassemble the string by taking a string and a var pairwise
+ # reassemble the string by taking a string and str(ref) pairwise
ret = ''
for i in range(0, len(self._refs)):
- ret += self._strings[i] + resolver(self._refs[i])
+ ret += self._strings[i] + str(resolver(self._refs[i]))
if len(self._strings) > len(self._refs):
# and finally append a trailing string, if any
ret += self._strings[-1]