mirror of
https://github.com/zulip/zulip.git
synced 2025-11-12 01:47:41 +00:00
Fix python 3 compatibility in logging code.
Detected by mypy.
This commit is contained in:
@@ -4,6 +4,7 @@ import hashlib
|
|||||||
import logging
|
import logging
|
||||||
import traceback
|
import traceback
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
from zerver.lib.str_utils import force_bytes
|
||||||
|
|
||||||
# Adapted http://djangosnippets.org/snippets/2242/ by user s29 (October 25, 2010)
|
# Adapted http://djangosnippets.org/snippets/2242/ by user s29 (October 25, 2010)
|
||||||
|
|
||||||
@@ -28,7 +29,7 @@ class _RateLimitFilter(object):
|
|||||||
use_cache = False
|
use_cache = False
|
||||||
|
|
||||||
if use_cache:
|
if use_cache:
|
||||||
tb = '\n'.join(traceback.format_exception(*record.exc_info))
|
tb = force_bytes('\n'.join(traceback.format_exception(*record.exc_info)))
|
||||||
key = self.__class__.__name__.upper() + hashlib.sha1(tb).hexdigest()
|
key = self.__class__.__name__.upper() + hashlib.sha1(tb).hexdigest()
|
||||||
duplicate = cache.get(key) == 1
|
duplicate = cache.get(key) == 1
|
||||||
if not duplicate:
|
if not duplicate:
|
||||||
|
|||||||
Reference in New Issue
Block a user