Skip to content

Commit

Permalink
registry: Better explain String.__str__
Browse files Browse the repository at this point in the history
  • Loading branch information
progval committed Dec 3, 2021
1 parent fba5ed5 commit ef0cd48
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,11 @@ def _needsQuoting(self, s):
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
Expand Down

0 comments on commit ef0cd48

Please sign in to comment.