Skip to content

Commit 0e51ade

Browse files
authored
Remove unused username functionality (#2699)
1 parent 889a4de commit 0e51ade

File tree

1 file changed

+0
-37
lines changed

1 file changed

+0
-37
lines changed

users/utils.py

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -12,43 +12,6 @@
1212
User = get_user_model()
1313
log = logging.getLogger(__name__)
1414

15-
USERNAME_SEPARATOR = "-"
16-
# Characters that should be replaced by the specified separator character
17-
USERNAME_SEPARATOR_REPLACE_CHARS = "\\s_"
18-
# Characters that should be removed entirely from the full name to create the username
19-
USERNAME_INVALID_CHAR_PATTERN = (
20-
rf"[^\w{USERNAME_SEPARATOR_REPLACE_CHARS}{USERNAME_SEPARATOR}]|[\d]"
21-
)
22-
23-
USERNAME_TURKISH_I_CHARS = r"[ıİ]"
24-
USERNAME_TURKISH_I_CHARS_REPLACEMENT = "i"
25-
26-
# Pattern for chars to replace with a single separator. The separator character itself
27-
# is also included in this pattern so repeated separators are squashed down.
28-
USERNAME_SEPARATOR_REPLACE_PATTERN = (
29-
rf"[{USERNAME_SEPARATOR_REPLACE_CHARS}{USERNAME_SEPARATOR}]+"
30-
)
31-
32-
33-
def _reformat_for_username(string):
34-
"""
35-
Removes/substitutes characters in a string to make it suitable as a username value
36-
37-
Args:
38-
string (str): A string
39-
Returns:
40-
str: A version of the string with username-appropriate characters
41-
"""
42-
cleaned_string = re.sub(USERNAME_INVALID_CHAR_PATTERN, "", string)
43-
cleaned_string = re.sub(
44-
USERNAME_TURKISH_I_CHARS, USERNAME_TURKISH_I_CHARS_REPLACEMENT, cleaned_string
45-
)
46-
return (
47-
re.sub(USERNAME_SEPARATOR_REPLACE_PATTERN, USERNAME_SEPARATOR, cleaned_string)
48-
.lower()
49-
.strip(USERNAME_SEPARATOR)
50-
)
51-
5215

5316
def is_duplicate_username_error(exc):
5417
"""

0 commit comments

Comments
 (0)