示例#1
0
 def email_address(self, value):
     # Silently truncate if necessary. In practice, this may be too
     # long if somebody put a super-long email into their contacts by
     # mistake or something.
     if value is not None:
         value = unicode_safe_truncate(value, MAX_INDEXABLE_LENGTH)
     self._raw_address = value
     self._canonicalized_address = canonicalize_address(value)
示例#2
0
 def sanitize_subject(self, key, value):
     # Trim overlong subjects, and remove null bytes. The latter can result
     # when, for example, UTF-8 text decoded from an RFC2047-encoded header
     # contains null bytes.
     if value is None:
         return
     value = unicode_safe_truncate(value, 255)
     value = value.replace('\0', '')
     return value
示例#3
0
 def sanitize_subject(self, key, value):
     # Trim overlong subjects, and remove null bytes. The latter can result
     # when, for example, UTF-8 text decoded from an RFC2047-encoded header
     # contains null bytes.
     if value is None:
         return
     value = unicode_safe_truncate(value, 255)
     value = value.replace('\0', '')
     return value
示例#4
0
def sanitize_name(name):
    return unicode_safe_truncate(name, MAX_INDEXABLE_LENGTH)
示例#5
0
 def calculate_plaintext_snippet(self, text):
     return unicode_safe_truncate(' '.join(text.split()), SNIPPET_LENGTH)
示例#6
0
 def validate_master_event_uid_length(self, key, value):
     if value is None:
         return None
     return unicode_safe_truncate(value, MAX_LENS[key])
示例#7
0
 def validate_text_column_length(self, key, value):
     if value is None:
         return None
     return unicode_safe_truncate(value, MAX_TEXT_CHARS)
示例#8
0
def sanitize_name(name):
    return unicode_safe_truncate(name, MAX_INDEXABLE_LENGTH)
示例#9
0
 def calculate_plaintext_snippet(self, text):
     return unicode_safe_truncate(' '.join(text.split()), SNIPPET_LENGTH)
示例#10
0
 def validate_length(self, key, value):
     if value is None:
         return None
     return unicode_safe_truncate(value, MAX_TEXT_LENGTH)
示例#11
0
 def validate_text_column_length(self, key, value):
     if value is None:
         return None
     return unicode_safe_truncate(value, MAX_TEXT_CHARS)
示例#12
0
 def validate_length(self, key, value):
     if value is None:
         return None
     return unicode_safe_truncate(value, MAX_TEXT_LENGTH)