0
0
mirror of https://github.com/django/django.git synced 2024-12-01 15:42:04 +01:00
Commit Graph

81 Commits

Author SHA1 Message Date
Jon Dufresne
359be1c870 Fixed #26691 -- Removed checking for a file's existence before deleting.
File operations always raise a ENOENT error when a file doesn't exist.
Checking the file exists before the operation adds a race condition
condition where the file could be removed between operations. As the
operation already raises an error on a missing file, avoid this race and
avoid checking the file exists twice. Instead only check a file exists
by catching the ENOENT error.
2016-05-31 12:03:27 -04:00
Claude Paroz
f4c2b8e04a Fixed #20189 -- Allowed customizing staticfiles ignored_patterns list
Thanks Tim Graham for the review.
2016-04-22 09:56:06 +02:00
Claude Paroz
edcecaf0de Fixed #19670 -- Applied CachedFilesMixin patterns to specific extensions
Thanks Simon Meers for the initial patch, and Tim Graham for the review.
2016-03-30 14:34:41 +02:00
Claude Paroz
859fc64338 Cleaned class inheritances in staticfiles tests
Thanks Tim Graham for precious inputs.
2016-03-28 19:46:03 +02:00
Berker Peksag
28bcff82c5 Fixed #26297 -- Fixed collectstatic --clear crash if storage doesn't implement path(). 2016-03-17 09:49:57 -04:00
Jon Dufresne
4e2da368db Cleaned up TestStaticFilePermissions to use call_command(). 2016-03-03 21:58:23 +01:00
James Aylett
1ff6e37de4 Fixed #23832 -- Added timezone aware Storage API.
New Storage.get_{accessed,created,modified}_time() methods convert the
naive time from now-deprecated {accessed,created_modified}_time()
methods into aware objects in UTC if USE_TZ=True.
2016-02-23 18:51:43 -05:00
Aymeric Augustin
7f6fbc906a Prevented static file corruption when URL fragment contains '..'.
When running collectstatic with a hashing static file storage backend,
URLs referencing other files were normalized with posixpath.normpath.
This could corrupt URLs: for example 'a.css#b/../c' became just 'c'.

Normalization seems to be an artifact of the historical implementation.
It contained a home-grown implementation of posixpath.join which relied
on counting occurrences of .. and /, so multiple / had to be collapsed.

The new implementation introduced in the previous commit doesn't suffer
from this issue. So it seems safe to remove the normalization.

There was a test for this normalization behavior but I don't think it's
a good test. Django shouldn't modify CSS that way. If a developer has
rendundant /s, it's mostly an aesthetic issue and it isn't Django's job
to fix it. Conversely, if the user wants a series of /s, perhaps in the
URL fragment, Django shouldn't destroy it.

Refs #26249.
2016-02-23 19:35:16 +01:00
Aymeric Augustin
706b33fef8 Fixed #26249 -- Fixed collectstatic crash for files in STATIC_ROOT referenced by absolute URL.
collectstatic crashed when:

* a hashing static file storage backend was used
* a static file referenced another static file located directly in
  STATIC_ROOT (not a subdirectory) with an absolute URL (which must
  start with STATIC_URL, which cannot be empty)

It seems to me that the current code reimplements relative path joining
and doesn't handle edge cases correctly. I suspect it assumes that
STATIC_URL is of the form r'/[^/]+/'.

Throwing out that code in favor of the posixpath module makes the logic
easier to follow. Handling absolute paths correctly also becomes easier.
2016-02-23 19:34:21 +01:00
Claude Paroz
269b5f262c Used call_command return value in staticfiles tests
Refs #26190.
2016-02-23 09:12:12 +01:00
Hasan
26ad01719d Refs #26022 -- Replaced six.assertRaisesRegex with assertRaisesMessage as appropriate. 2016-01-29 13:37:33 -05:00
Hasan
3d0dcd7f5a Refs #26022 -- Used context manager version of assertRaises in tests. 2016-01-29 12:32:18 -05:00
Johannes Hoppe
20e2b228aa Refs #21221 -- Added test for legacy static usage in form Media.
Before cf546e1, static files in form or widget Media were usually
wrapped with contrib.staticfiles.templatetags.staticfiles.static.
This test ensures compatibility with third-party code that's still
using this pattern.
2016-01-19 06:57:20 -05:00
Johannes Hoppe
cf546e11ac Fixed #21221 -- Made form Media and static template tag use staticfiles if installed. 2015-12-10 14:30:19 -05:00
Josh Soref
93452a70e8 Fixed many spelling mistakes in code, comments, and docs. 2015-12-03 12:48:24 -05:00
Alex Morozov
6ca163d7cc Fixed #25784 -- Prevented an exception on collectstatic help
Made the `manage.py help collectstatic` don't fail if the `STATIC_ROOT`
setting is empty.
2015-11-22 20:32:14 +01:00
msaelices
7624fdb9f8 Fixed #25283 -- Fixed collectstatic crash if a URL contains a fragment with a path.
A @font-face declaration may contain a fragment that looks like a relative path,
e.g. @font-face { src: url('../fonts/font.svg#../path/like/fragment'); }
In this case, an incorrect path was passed to the storage backend, which raised
an error that caused collectstatic to crash.
2015-11-12 19:30:48 -05:00
Yusuke Miyazaki
0922bbf18d Fixed #25346 -- Allowed collectstatic to delete broken symlinks. 2015-10-17 14:13:31 -04:00
Aymeric Augustin
bf2c969eb7 Prevented staticfiles test from colliding when run in parallel.
This requires that each test never alters files in static directories
collected by other tests. The alternative is to add a temporary
directory to STATICFILES_DIRS or a new app to INSTALLED_APPS.
2015-09-09 23:01:17 +02:00
Andriy Sokolovskiy
b40c551fdf Fixed some unclosed objects in tests 2015-07-06 10:10:40 -04:00
Moritz Sichert
b35b43dff8 Fixed #24982 -- Split staticfiles tests into multiple files 2015-07-01 09:41:27 -04:00
Markus Amalthea Magnuson
5304494585 Fixed #24890 -- Added warning to collectstatic when static files have clashing names 2015-06-13 20:34:24 -04:00
Simon Charette
be67400b47 Refs #24652 -- Used SimpleTestCase where appropriate. 2015-05-20 13:46:13 -04:00
Tim Graham
389baccac5 Fixed staticfiles test on Windows; refs #23986. 2015-03-11 14:49:15 -04:00
Sztrovacsek
87d78241a2 Fixed #23986 -- Fixed collectstatic --clear failure if STATIC_ROOT dir doesn't exist. 2015-03-07 10:47:07 -05:00
Aymeric Augustin
952ce778c6 Fixed a test failure under Windows and Python 2. 2015-02-23 18:36:15 +01:00
Aymeric Augustin
934400759d Guaranteed removal of temporary files during tests.
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.
2015-02-23 16:55:26 +01:00
Aymeric Augustin
c688460df6 Removed rmtree_errorhandler.
The stated reason for its introduction in d18d37ce no longer applies
since Django's code repository was switched from Subversion to git.

Furthermore it never had any effect because shutil.rmtree ignores its
onerror argument when ignore_errors is True.

The reason for its use in template management commands is unclear.
2015-02-22 23:09:42 +01:00
Aymeric Augustin
787dd6519a Removed obsolete reference to media directory. 2015-02-21 17:52:24 +01:00
Aymeric Augustin
bd059e3f8c Removed workaround for SVN limitations.
In addition to simplifying the code, this reduces the number of writes.
2015-02-21 17:52:24 +01:00
Aymeric Augustin
2bb5b0e098 Avoided collecting admin static files in tests.
This makes the staticfiles tests 2.5 times faster.
2015-02-21 17:46:26 +01:00
Aymeric Augustin
1d9d39fa1c Removed TestServeAdminMedia.
It should have been removed when the ADMIN_MEDIA_PREFIX setting was deprecated.
2015-02-21 17:46:26 +01:00
Tim Graham
307c0f299a Refs #24324 -- Fixed Python 2 test failures when path to Django source contains non-ASCII characters. 2015-02-17 19:03:03 -05:00
Tim Graham
0ed7d15563 Sorted imports with isort; refs #23860. 2015-02-06 08:16:28 -05:00
mlavin
2730dad0d7 Fixed #24197 -- Added clearing of staticfiles caches on settings changes during tests
Cleared caching in staticfiles_storage and get_finder when
relevant settings are changed.
2015-02-04 10:53:04 -05:00
darkryder
9ec8aa5e5d Fixed #24149 -- Normalized tuple settings to lists. 2015-02-03 14:59:45 -05:00
Tim Graham
b9feec959b Fixed #23700 -- Fixed non-deterministic static files test failures on Windows.
This partially reverts commit 949ee521fa
refs #21230.
2015-01-01 13:57:52 -05:00
Diego Guimarães
fd60e6c887 Refs #23947 -- Prevented staticfiles tests from having side effects. 2014-12-09 11:17:05 -05:00
Aymeric Augustin
c0c1bb9e64 Avoided using private API get_template_from_string. 2014-10-31 11:38:53 +01:00
Aymeric Augustin
9562ffea97 Avoid the word "stupid".
There's always a better word.
2014-09-09 20:55:57 +02:00
Claude Paroz
3a44e20005 Fixed #23374 -- Renamed StaticLiveServerCase to StaticLiveServerTestCase
Refs #20739. Thanks Raphaël Hertzog for the report and the initial
patch.
2014-08-28 08:44:26 +02:00
Tim Graham
d38a00332e Updated tests for added newlines in 6868643063. 2014-08-12 20:16:04 -04:00
Trey Hunner
6868643063 Added newlines to the ends of CSS, HTML, and JavaScript files missing them. 2014-08-12 19:22:09 -04:00
Claude Paroz
c6a711d9e5 Removed some apps from ALWAYS_INSTALLED_APPS 2014-06-21 21:01:37 +02:00
Claude Paroz
f17b24e407 Converted remaining management commands to argparse 2014-06-14 13:43:44 +02:00
Tim Graham
9980f67154 Fixed a staticfiles test on Windows. 2014-06-12 13:08:27 -04:00
Denis Cornehl
3bec38888f Fixed #22557 -- ManifestStaticFilesStorage did not cleanup deleted files.
When using ManifestStaticFilesStorage, deleted static files would be
correctly cleaned up by "collectstatic --clear", but the manifest file
would still contain the stale entries.

Thanks to tedtieken for the report
2014-05-20 18:14:49 +02:00
Huu Nguyen
949ee521fa Refs #21230 -- removed direct settings manipulation from staticfile tests 2014-05-18 14:27:35 -04:00
Florian Apolloner
a4553e0510 Fixed monkeypatching in a staticfiles test. 2014-04-21 14:51:52 +02:00
Aymeric Augustin
428c0bbe1b Appeased flake8 2.1.0. 2014-04-21 12:27:34 +02:00