diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/examples/kaitai/kshelpers.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/python/examples/kaitai/kshelpers.py b/python/examples/kaitai/kshelpers.py index a4453739..bcdc9931 100644 --- a/python/examples/kaitai/kshelpers.py +++ b/python/examples/kaitai/kshelpers.py @@ -411,10 +411,11 @@ def createLeaf(fieldName, obj): fieldValue = None - if isinstance(obj, str): - fieldValue = repr(obj) - elif isinstance(obj, bytes): - fieldValue = repr(obj) + if isinstance(obj, str) or isinstance(obj, bytes): + if len(obj) > 8: + fieldValue = str(repr(obj[0:8])) + '...' + else: + fieldValue = repr(obj) elif sys.version_info[0] == 2 and objtype == types.UnicodeType: fieldValue = repr(obj) elif isinstance(obj, int): |
