Skip to content
This repository has been archived by the owner on Mar 8, 2021. It is now read-only.

Commit

Permalink
Rename unicode_output to use_unicode
Browse files Browse the repository at this point in the history
  • Loading branch information
charlax committed Jun 2, 2014
1 parent afa01bd commit 1ea5752
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions charlatan/file_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def relationship_constructor(loader, node):
def configure_output(use_unicode=False):
"""Configure output options of the values loaded by pyyaml
:param boolean use_unicode: Use unicode constructor for loading strings
:param bool use_unicode: Use unicode constructor for loading strings
"""
if use_unicode:
yaml.add_constructor(
Expand All @@ -69,7 +69,7 @@ def configure_output(use_unicode=False):
)


def load_file(filename, unicode_output=False):
def load_file(filename, use_unicode=False):
"""Load fixtures definition from file.
:param str filename:
Expand All @@ -81,7 +81,7 @@ def load_file(filename, unicode_output=False):
if filename.endswith(".yaml"):
# Load the custom YAML tags
configure_yaml()
configure_output(use_unicode=unicode_output)
configure_output(use_unicode=use_unicode)
content = yaml.load(content)
else:
raise ValueError("Unsupported filetype: '%s'" % filename)
Expand Down
6 changes: 3 additions & 3 deletions charlatan/fixtures_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ class FixturesManager(object):
"""

def __init__(self, db_session=None, unicode_output=False):
def __init__(self, db_session=None, use_unicode=False):
self.hooks = {}
self.session = db_session
self.installed_keys = []
self.unicode_output = unicode_output
self.use_unicode = use_unicode

def load(self, filename, models_package=""):
"""Pre-load the fixtures.
Expand Down Expand Up @@ -88,7 +88,7 @@ def _load_fixtures(self, filename):
:param str filename: file that holds the fixture data
"""

content = load_file(filename, self.unicode_output)
content = load_file(filename, self.use_unicode)

fixtures = {}
for k, v in _compat.iteritems(content):
Expand Down
2 changes: 1 addition & 1 deletion charlatan/tests/test_strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def setUp(self):
]
self.yaml = file_format.load_file(
'./charlatan/tests/data/strings.yaml',
unicode_output=True,
use_unicode=True,
)

def tearDown(self):
Expand Down
6 changes: 3 additions & 3 deletions docs/file-format.rst
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,6 @@ Unicode Strings

.. versionadded:: 0.3.5

In python 2 strings are not, by default, loaded as unicode. To load all the
strings from the yaml files as unicode strings, pass the option
`unicode_output` as `True` when you instantiate your fixture manager.
In python 2 strings are not, by default, loaded as unicode. To load all the
strings from the yaml files as unicode strings, pass the option
`use_unicode` as `True` when you instantiate your fixture manager.

0 comments on commit 1ea5752

Please sign in to comment.