remove one last unicode + safer default param

This commit is contained in:
Stefan Wojcik 2016-12-06 23:36:57 -05:00
parent bc83ba6a24
commit c1993de524

View File

@ -69,7 +69,7 @@ class StringField(BaseField):
super(StringField, self).__init__(**kwargs) super(StringField, self).__init__(**kwargs)
def to_python(self, value): def to_python(self, value):
if isinstance(value, unicode): if isinstance(value, six.text_type):
return value return value
try: try:
value = value.decode('utf-8') value = value.decode('utf-8')
@ -1038,12 +1038,15 @@ class CachedReferenceField(BaseField):
.. versionadded:: 0.9 .. versionadded:: 0.9
""" """
def __init__(self, document_type, fields=[], auto_sync=True, **kwargs): def __init__(self, document_type, fields=None, auto_sync=True, **kwargs):
"""Initialises the Cached Reference Field. """Initialises the Cached Reference Field.
:param fields: A list of fields to be cached in document :param fields: A list of fields to be cached in document
:param auto_sync: if True documents are auto updated. :param auto_sync: if True documents are auto updated.
""" """
if fields is None:
fields = []
if ( if (
not isinstance(document_type, six.string_types) and not isinstance(document_type, six.string_types) and
not issubclass(document_type, Document) not issubclass(document_type, Document)