Skip to content

Commit

Permalink
fix: [yaml] add workaround to add constructor for unicode strings
Browse files Browse the repository at this point in the history
  • Loading branch information
ssato committed Mar 12, 2017
1 parent 628cb4a commit 16e52d9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions anyconfig/backend/yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,16 @@ def construct_mapping(loader, node, deep=False):

return mapping

tag = "tag:yaml.org,2002:python/unicode"

def construct_ustr(loader, node):
return loader.construct_scalar(node)

try:
loader.add_constructor(tag, construct_ustr)
except NameError:
pass

if type(container) != dict:
loader.add_constructor(mapping_tag, construct_mapping)
return loader
Expand Down

0 comments on commit 16e52d9

Please sign in to comment.