mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 13:44:48 -04:00
remove to_ascii
this is a no-op on python 3.
This commit is contained in:
parent
08fa96f030
commit
65902e08c3
3 changed files with 12 additions and 38 deletions
|
@ -19,8 +19,7 @@ import re
|
|||
import string
|
||||
from collections import Iterable
|
||||
|
||||
import six
|
||||
from six import PY2, PY3
|
||||
from six import PY3
|
||||
from six.moves import range
|
||||
|
||||
from synapse.api.errors import Codes, SynapseError
|
||||
|
@ -68,23 +67,6 @@ def is_ascii(s):
|
|||
return True
|
||||
|
||||
|
||||
def to_ascii(s):
|
||||
"""Converts a string to ascii if it is ascii, otherwise leave it alone.
|
||||
|
||||
If given None then will return None.
|
||||
"""
|
||||
if PY3:
|
||||
return s
|
||||
|
||||
if s is None:
|
||||
return None
|
||||
|
||||
try:
|
||||
return s.encode("ascii")
|
||||
except UnicodeEncodeError:
|
||||
return s
|
||||
|
||||
|
||||
def assert_valid_client_secret(client_secret):
|
||||
"""Validate that a given string matches the client_secret regex defined by the spec"""
|
||||
if client_secret_regex.match(client_secret) is None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue