mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Revert "Add yaml_safe filter"
This reverts commit2405ff11b5
. This never worked: * yaml_txt is stripped and never ends with a '\n' * len(string - 5) doesn't work * yaml.safe_dump() doesn't allow to set a custom Dumper() (see10c55a6244/lib/yaml/__init__.py (__init__.py-212)
) Also, #36611 for related bug and fix.
This commit is contained in:
parent
ec60f9c721
commit
f7712d417f
1 changed files with 0 additions and 8 deletions
|
@ -349,7 +349,6 @@ class SerializerExtension(Extension, object):
|
|||
super(SerializerExtension, self).__init__(environment)
|
||||
self.environment.filters.update({
|
||||
'yaml': self.format_yaml,
|
||||
'yaml_safe': self.format_yaml_safe,
|
||||
'json': self.format_json,
|
||||
'python': self.format_python,
|
||||
'load_yaml': self.load_yaml,
|
||||
|
@ -391,13 +390,6 @@ class SerializerExtension(Extension, object):
|
|||
yaml_txt = yaml_txt[:len(yaml_txt)-4]
|
||||
return Markup(yaml_txt)
|
||||
|
||||
def format_yaml_safe(self, value, flow_style=True):
|
||||
yaml_txt = yaml.safe_dump(value, default_flow_style=flow_style,
|
||||
Dumper=OrderedDictDumper).strip()
|
||||
if yaml_txt.endswith('\n...\n'):
|
||||
yaml_txt = yaml_txt[:len(yaml_txt-5)]
|
||||
return Markup(yaml_txt)
|
||||
|
||||
def format_python(self, value):
|
||||
return Markup(pprint.pformat(value).strip())
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue