1
0
mirror of https://github.com/django/django.git synced 2025-10-26 07:06:08 +00:00

Don't use os.system() in compilemessages.

Fixes #19584.

This implies stop storing file path command line arguments in envvars as
a security measure to start relying on with Popen's shell=False instead,
and addition of an 'utils' module.

Thanks kmichel_wgs for the report.
This commit is contained in:
Ramiro Morales
2013-02-12 13:58:49 -03:00
parent 5c51d71f9a
commit dfa9324966
5 changed files with 67 additions and 14 deletions

View File

@@ -99,3 +99,22 @@ class MultipleLocaleCompilationTests(MessageCompilationTests):
self.assertTrue(os.path.exists(self.MO_FILE_HR))
self.assertTrue(os.path.exists(self.MO_FILE_FR))
class CompilationErrorHandling(MessageCompilationTests):
LOCALE='ja'
MO_FILE='locale/%s/LC_MESSAGES/django.mo' % LOCALE
def setUp(self):
super(CompilationErrorHandling, self).setUp()
self.addCleanup(self._rmfile, os.path.join(test_dir, self.MO_FILE))
def _rmfile(self, filepath):
if os.path.exists(filepath):
os.remove(filepath)
def test_error_reported_by_msgfmt(self):
os.chdir(test_dir)
with self.assertRaises(CommandError):
call_command('compilemessages', locale=self.LOCALE, stderr=StringIO())