changeset 737:775e7f74096a

For #60, encode user photo filenames before logging.
author Brian Neal <bgneal@gmail.com>
date Fri, 13 Dec 2013 19:59:36 -0600 (2013-12-14)
parents 1fe6b98f3eab
children df2799f725d8
files core/image_uploader.py sg101/settings/local.py sg101/settings/production.py
diffstat 3 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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)
--- 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',
--- 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',