mirror of
https://github.com/zulip/zulip.git
synced 2025-11-16 20:02:15 +00:00
Fix zerver.lib.utils.generate_random_token.
generate_random_token used to return a value of type six.binary_type and its return type was annotated as `str`. This commit fixes that by making it return a value of type `six.text_type` and updating the annotation accordingly. Also fix clashing annnotations.
This commit is contained in:
committed by
Tim Abbott
parent
56d5785c2e
commit
10f2ec043d
@@ -110,5 +110,5 @@ def log_statsd_event(name):
|
||||
statsd.incr(event_name)
|
||||
|
||||
def generate_random_token(length):
|
||||
# type: (int) -> str
|
||||
return base64.b16encode(os.urandom(length // 2)).lower()
|
||||
# type: (int) -> text_type
|
||||
return base64.b16encode(os.urandom(length // 2)).decode('utf-8').lower()
|
||||
|
||||
@@ -541,7 +541,7 @@ class MitUser(models.Model):
|
||||
status = models.IntegerField(default=0)
|
||||
|
||||
def generate_email_token_for_stream():
|
||||
# type: () -> str
|
||||
# type: () -> text_type
|
||||
return generate_random_token(32)
|
||||
|
||||
class Stream(models.Model):
|
||||
|
||||
@@ -961,7 +961,7 @@ def update_pointer_backend(request, user_profile,
|
||||
return json_success()
|
||||
|
||||
def generate_client_id():
|
||||
# type: () -> str
|
||||
# type: () -> text_type
|
||||
return generate_random_token(32)
|
||||
|
||||
# The order of creation of the various dictionaries are important.
|
||||
|
||||
Reference in New Issue
Block a user