Ensure repr is is limited to string_max_length

This commit is contained in:
David Cramer 2015-08-26 13:57:18 -07:00
parent 94a6d6a873
commit 8b0aad48f1
1 changed files with 3 additions and 1 deletions

View File

@ -50,10 +50,12 @@ class Serializer(object):
Given ``value``, recurse (using the parent serializer) to handle
coercing of newly defined values.
"""
string_max_length = kwargs.get('string_max_length', None)
_depth += 1
if _depth >= max_depth:
try:
value = six.text_type(repr(value))
value = six.text_type(repr(value))[:string_max_length]
except Exception as e:
import traceback
traceback.print_exc()