MCPcopy
hub / github.com/django/django / to_python

Method to_python

django/contrib/auth/forms.py:60–69  ·  view source on GitHub ↗
(self, value)

Source from the content-addressed store, hash-verified

58
59class UsernameField(forms.CharField):
60 def to_python(self, value):
61 value = super().to_python(value)
62 if self.max_length is not None and len(value) > self.max_length:
63 # Normalization can increase the string length (e.g.
64 # "ff" -> "ff", "½" -> "1⁄2") but cannot reduce it, so there is no
65 # point in normalizing invalid data. Moreover, Unicode
66 # normalization is very slow on Windows and can be a DoS attack
67 # vector.
68 return value
69 return unicodedata.normalize("NFKC", value)
70
71 def widget_attrs(self, widget):
72 return {

Callers 15

check_site_idFunction · 0.45
_get_user_session_keyFunction · 0.45
_aget_user_session_keyFunction · 0.45
get_userMethod · 0.45
__get__Method · 0.45
get_objectMethod · 0.45
get_search_resultsMethod · 0.45
build_instanceFunction · 0.45
m2m_convertFunction · 0.45
deserialize_fk_valueFunction · 0.45

Calls 1

normalizeMethod · 0.45

Tested by 1