membershipworks: Collapse sequential periods in ucsAccounts usernames
This commit is contained in:
parent
796f0d6ad1
commit
e4f9e89dd5
@ -22,7 +22,7 @@ GROUPS_REGEX = "|".join(
|
|||||||
# A group name must start and end with a letter, number or underscore.
|
# A group name must start and end with a letter, number or underscore.
|
||||||
# In between additionally spaces, dashes and dots are allowed.
|
# In between additionally spaces, dashes and dots are allowed.
|
||||||
def sanitize_group_name(name):
|
def sanitize_group_name(name):
|
||||||
sanitized_body = re.sub(r"[^0-9A-Za-z_ -.]", ".", name)
|
sanitized_body = re.sub(r"[^0-9A-Za-z_ -.]+", ".", name)
|
||||||
sanitized_start_end = re.sub("^[^0-9A-Za-z_]|[^0-9A-Za-z_]$", "_", sanitized_body)
|
sanitized_start_end = re.sub("^[^0-9A-Za-z_]|[^0-9A-Za-z_]$", "_", sanitized_body)
|
||||||
|
|
||||||
return "MW_" + sanitized_start_end
|
return "MW_" + sanitized_start_end
|
||||||
|
Loading…
Reference in New Issue
Block a user