From ef0cd48bd15fcde676bf7da8316e17569c0e229e Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Fri, 3 Dec 2021 18:03:27 +0100 Subject: [PATCH] registry: Better explain String.__str__ --- src/registry.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/registry.py b/src/registry.py index 88c8f7b98..a0d737e0b 100644 --- a/src/registry.py +++ b/src/registry.py @@ -660,7 +660,11 @@ class String(Value): return any([x not in self._printable for x in s]) and s.strip() != s def __str__(self): - s = Value.__call__(self) # Don't call self(), it might be overridden + # Don't call self(), it might be overridden; and this can cause various + # problem (eg. registry.Json.__call__ returns non-strings, + # conf.Directory.__call__ has filesystem side-effects that we shouldn't + # trigger here, etc.) + s = Value.__call__(self) if self._needsQuoting(s): s = repr(s) return s