summaryrefslogtreecommitdiff
path: root/representer.py
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2017-08-05 15:00:59 +0200
committerAnthon van der Neut <anthon@mnt.org>2017-08-05 15:00:59 +0200
commitb2b5c88bf7af6d8d3e1815f78fbb3bd5988ab498 (patch)
tree6802edfb5813d9b5c214ed89eb1cc0627c71dbfb /representer.py
parentf9ce843b3f2342998fff0f053d4dfb51c049ebdd (diff)
downloadruamel.yaml-b2b5c88bf7af6d8d3e1815f78fbb3bd5988ab498.tar.gz
yaml.boolean_representation = [u'False', u'True']
Diffstat (limited to 'representer.py')
-rw-r--r--representer.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/representer.py b/representer.py
index 6d1e8c1..f441d80 100644
--- a/representer.py
+++ b/representer.py
@@ -275,10 +275,13 @@ class SafeRepresenter(BaseRepresenter):
def represent_bool(self, data):
# type: (Any) -> Any
- if data:
- value = u'true'
- else:
- value = u'false'
+ try:
+ value = self.dumper.boolean_representation[bool(data)]
+ except AttributeError:
+ if data:
+ value = u'true'
+ else:
+ value = u'false'
return self.represent_scalar(u'tag:yaml.org,2002:bool', value)
def represent_int(self, data):