Debian packages unconditionally byte-compile .py files on installation and
do not silence errors by design. Therefore, we need a way of shipping these
invalid .py files without a .py extension but ensuring that when we
template them, they end up as .py.
We don't special-case .py files so that the all the TemplateCommand
command-line options (eg. extra_files and extensions) still work entirely
as expected and it may even be useful for other formats too.
Traceback (most recent call last):
File "tests\admin_scripts\tests.py", line 646, in test_startapp_unicode_name
content = f.read()
File "lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 46: character maps to <undefined>
Dropped the DJANGO_TEST_TEMP_DIR environment variable.
Before this change, proper removal depended on the developer passing
dir=os.environ['DJANGO_TEST_TMP_DIR'] to tempfile functions.
This is a performance optimization and also fixes test errors with the
upcoming merge of contrib tests into tests/. The tests failed on MySQL
because the models with GeometryField were being checked but the
non-GIS MySQL backend didn't know how to handle them.
This includes the following improvements:
- The type of the style object is now called 'Style' rather than 'dummy'.
- The new make_style() function allows generating a Style object directly
from a config string. Before the only way to get a style object was
through the environ and it also required that the terminal supported
colors which isn't necessarily the case when testing.
- The output of no_style() is now cached with @lru_cache.
- The output of no_style() now has the same set of attributes as the
other Style objects. Previously it allowed anything to pass through
with __getattr__.
This helps with testability of management commands.
Thanks to trac username daveoncode for the report and to
Tim Graham and Claude Paroz for the reviews.
This commit reverts 67d7da5fb9.
The previous fix changed the environment globally, which meant
that any call to `call_command(no_color=True)` prevented further
`call_command` with color.
This fix still relies on the environment because it's currently the only
way to reach WSGIRequestHandler, but it's now limited to the `runserver`
command. This seems an acceptable compromise considering `runserver` runs
indefinitely.
Thanks Tim Graham for the review.