log_event: Fix unicode handling of log writing.

This commit is contained in:
Tim Abbott 2016-09-19 21:45:52 -07:00
parent 939528303d
commit e488d4d6e8
1 changed files with 2 additions and 2 deletions

View File

@ -68,7 +68,7 @@ from zerver.lib.request import JsonableError
from zerver.lib.session_user import get_session_user from zerver.lib.session_user import get_session_user
from zerver.lib.upload import attachment_url_re, attachment_url_to_path_id, \ from zerver.lib.upload import attachment_url_re, attachment_url_to_path_id, \
claim_attachment, delete_message_image claim_attachment, delete_message_image
from zerver.lib.str_utils import NonBinaryStr from zerver.lib.str_utils import NonBinaryStr, force_str
import DNS import DNS
import ujson import ujson
@ -113,7 +113,7 @@ def log_event(event):
with lockfile(template % ('lock',)): with lockfile(template % ('lock',)):
with open(template % ('events',), 'a') as log: with open(template % ('events',), 'a') as log:
log.write(ujson.dumps(event) + u'\n') log.write(force_str(ujson.dumps(event) + u'\n'))
def active_user_ids(realm): def active_user_ids(realm):
# type: (Realm) -> List[int] # type: (Realm) -> List[int]