diff options
author | Brenton Leanhardt <bleanhar@redhat.com> | 2016-01-12 11:56:28 -0500 |
---|---|---|
committer | Brenton Leanhardt <bleanhar@redhat.com> | 2016-01-12 11:56:28 -0500 |
commit | 920fdaab001e27e9064a939eba6b3082c7230f43 (patch) | |
tree | b3f4972b330f235125066a2039d1bcc9e4fac560 /filter_plugins/oo_filters.py | |
parent | ec643bee6b4de6d26f5aea346d73e8158f10939e (diff) | |
parent | 0d6ec0d9547ac95980d4444aa70216312455e837 (diff) | |
download | openshift-920fdaab001e27e9064a939eba6b3082c7230f43.tar.gz openshift-920fdaab001e27e9064a939eba6b3082c7230f43.tar.bz2 openshift-920fdaab001e27e9064a939eba6b3082c7230f43.tar.xz openshift-920fdaab001e27e9064a939eba6b3082c7230f43.zip |
Merge pull request #1168 from detiber/padded_yaml_fix
Fix for to_padded_yaml filter
Diffstat (limited to 'filter_plugins/oo_filters.py')
-rw-r--r-- | filter_plugins/oo_filters.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/filter_plugins/oo_filters.py b/filter_plugins/oo_filters.py index c262693ec..671c237b9 100644 --- a/filter_plugins/oo_filters.py +++ b/filter_plugins/oo_filters.py @@ -479,6 +479,9 @@ class FilterModule(object): @staticmethod def to_padded_yaml(data, level=0, indent=2, **kw): ''' returns a yaml snippet padded to match the indent level you specify ''' + if data in [None, ""]: + return "" + try: transformed = yaml.safe_dump(data, indent=indent, allow_unicode=True, default_flow_style=False, **kw) padded = "\n".join([" " * level * indent + line for line in transformed.splitlines()]) |