def __init__(
self,
max_bytes,
truncate = True,
prefix = '',
encoding = 'utf-8',
):
# type: (int, bool, Text, Text) -> None
"""
:param max_bytes:
Max number of bytes to allow.
:param truncate:
Whether to truncate values that are too long.
Set this to ``False`` to save system resources when you
know that you will reject values that are too long.
:param prefix:
Prefix to apply to truncated values.
Ignored when ``truncate`` is ``False``.
:param encoding:
The character encoding to check against.
Note: This filter is optimized for UTF-8.
"""
super(MaxBytes, self).__init__()
self.encoding = encoding
self.max_bytes = max_bytes
self.prefix = prefix
self.truncate = truncate
评论列表
文章目录