Skip to content

Commit

Permalink
Use declared yaml options
Browse files Browse the repository at this point in the history
Fixes #20647
  • Loading branch information
Mike Place committed Feb 18, 2015
1 parent 9f8739c commit 53881ac
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions salt/utils/serializers/yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

from salt.utils.serializers import DeserializationError, SerializationError
import salt.ext.six as six
from salt.utils.odict import OrderedDict

__all__ = ['deserialize', 'serialize', 'available']

Expand All @@ -41,7 +42,7 @@ def deserialize(stream_or_string, **options):
:param options: options given to lower yaml module.
"""

options.setdefault('Loader', BaseLoader)
options.setdefault('Loader', Loader)
try:
return yaml.load(stream_or_string, **options)
except ScannerError as error:
Expand All @@ -64,7 +65,7 @@ def serialize(obj, **options):
:param options: options given to lower yaml module.
"""

options.setdefault('Dumper', BaseDumper)
options.setdefault('Dumper', Dumper)
try:
response = yaml.dump(obj, **options)
if response.endswith('\n...\n'):
Expand Down Expand Up @@ -113,3 +114,4 @@ class Dumper(BaseDumper): # pylint: disable=W0232
Dumper.add_multi_representer(datetime.date, Dumper.represent_date)
Dumper.add_multi_representer(datetime.datetime, Dumper.represent_datetime)
Dumper.add_multi_representer(None, Dumper.represent_undefined)
Dumper.add_multi_representer(OrderedDict, Dumper.represent_dict)

0 comments on commit 53881ac

Please sign in to comment.