Commits

Diego Búrigo Zacarão committed b88c5d9

Fixed encode error with localized exception messages

Comments (0)

Files changed (1)

transifex/storage/api.py

                         'name':sf.name})
                 except Exception, e:
                     if isinstance(e, FileCheckError) or isinstance(e, LinguistParseError):
-                        message = str(e)
+                        #FIXME: Custom Exception should use an extra attr for 
+                        # localized string.
+                        message = e.message
                     else:
                         #TODO Send email to admins
                         message = _("A strange error happened.")
+                        logger.debug(str(e))
 
                     # The object is not saved yet, but it removes file from 
                     # the filesystem
                     StorageFile.objects.filter(
                         id__in=[f['id'] for f in files]).delete()
 
-                    logger.debug(str(e))
                     retval=dict(status='Error', message=message)
 
             if not retval: