python3: Mark certain strings as unicode strings.

This is required in Python 3 since these strings are combined with
other unicode strings.
This commit is contained in:
Tim Abbott 2016-01-23 20:17:25 -08:00
parent fc0a414fe6
commit a46647a87a
2 changed files with 2 additions and 2 deletions

View File

@ -88,7 +88,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) + '\n') log.write(ujson.dumps(event) + u'\n')
def active_user_ids(realm): def active_user_ids(realm):
return [userdict['id'] for userdict in get_active_user_dicts_in_realm(realm)] return [userdict['id'] for userdict in get_active_user_dicts_in_realm(realm)]

View File

@ -75,7 +75,7 @@ class QueueProcessingWorker(object):
os.mkdir(settings.QUEUE_ERROR_DIR) os.mkdir(settings.QUEUE_ERROR_DIR)
fname = '%s.errors' % (self.queue_name,) fname = '%s.errors' % (self.queue_name,)
fn = os.path.join(settings.QUEUE_ERROR_DIR, fname) fn = os.path.join(settings.QUEUE_ERROR_DIR, fname)
line = '%s\t%s\n' % (time.asctime(), ujson.dumps(data)) line = u'%s\t%s\n' % (time.asctime(), ujson.dumps(data))
lock_fn = fn + '.lock' lock_fn = fn + '.lock'
with lockfile(lock_fn): with lockfile(lock_fn):
with open(fn, 'a') as f: with open(fn, 'a') as f: