# HG changeset patch # User Brian Neal # Date 1386986376 21600 # Node ID 775e7f74096a29ec2425181405bc02f550f1f7dc # Parent 1fe6b98f3eab378e598f0ad76363ef7b6d136294 For #60, encode user photo filenames before logging. diff -r 1fe6b98f3eab -r 775e7f74096a core/image_uploader.py --- a/core/image_uploader.py Sat Nov 09 11:53:23 2013 -0600 +++ b/core/image_uploader.py Fri Dec 13 19:59:36 2013 -0600 @@ -44,7 +44,8 @@ a thumbnail was not requested. """ - logger.info('Processing image file: {}'.format(fp.name)) + filename = fp.name.encode('utf-8') + logger.info('Processing image file: %s', filename) # Trying to use PIL (or Pillow) on a Django UploadedFile is often # problematic because the file is often an in-memory file if it is under @@ -92,6 +93,6 @@ thumb.getvalue(), metadata) - logger.info('Completed processing image file: {}'.format(fp.name)) + logger.info('Completed processing image file: %s', filename) return (image_url, thumb_url) diff -r 1fe6b98f3eab -r 775e7f74096a sg101/settings/local.py --- a/sg101/settings/local.py Sat Nov 09 11:53:23 2013 -0600 +++ b/sg101/settings/local.py Fri Dec 13 19:59:36 2013 -0600 @@ -64,6 +64,7 @@ 'mode': 'a', 'maxBytes': 100 * 1024, 'backupCount': 10, + 'encoding': 'utf-8', }, 'auth': { 'class': 'logging.handlers.RotatingFileHandler', @@ -73,6 +74,7 @@ 'mode': 'a', 'maxBytes': 2 * 1024 * 1024, 'backupCount': 5, + 'encoding': 'utf-8', }, 'mail_admins': { 'class': 'django.utils.log.AdminEmailHandler', diff -r 1fe6b98f3eab -r 775e7f74096a sg101/settings/production.py --- a/sg101/settings/production.py Sat Nov 09 11:53:23 2013 -0600 +++ b/sg101/settings/production.py Fri Dec 13 19:59:36 2013 -0600 @@ -76,6 +76,7 @@ 'mode': 'a', 'maxBytes': 100 * 1024, 'backupCount': 10, + 'encoding': 'utf-8', }, 'auth': { 'class': 'logging.handlers.RotatingFileHandler', @@ -85,6 +86,7 @@ 'mode': 'a', 'maxBytes': 2 * 1024 * 1024, 'backupCount': 5, + 'encoding': 'utf-8', }, 'mail_admins': { 'class': 'django.utils.log.AdminEmailHandler',