Commit Graph

25 Commits

Author SHA1 Message Date
Carl Meyer f56c88a8ee Fixed #21867 -- Removed AppStaticStorage; app paths are now AppConfig's job.
AppStaticStorage only provided one thing over FileSystemStorage, which was
taking an app name (import path) and translating it into a filesystem
path. This is now something that should be done via app_config.path instead,
leaving AppStaticStorage with no reason for existence. It should be safe to
remove, as it was undocumented internal API.

There was some kind of feature in the AppDirectoriesFinder code related to a
"prefix" attribute on the storage class used by AppDirectoriesFinder. Since
this feature was undocumented, untested, and of unclear purpose, I removed it
as well.
2014-01-24 15:32:03 -07:00
Loic Bistuer 1e9e7351f8 Fixed #21750 -- Fixed regression introduced by 4befb30.
Validating STATIC_ROOT in StaticFilesStorage.__init__ turned out to be
problematic - especially with tests - because the storage refuses to work even
if there are no actual interactions with the file system, which is backward
incompatible.

Originally the validation happened in the StaticFilesStorage.path method, but
that didn't work as expected because the call to FileSystemStorage.__init__
replaced the empty value by a valid path. The new approach is to move back the
check to the StaticFilesStorage.path method, but ensure that the location
attribute remains None after the call to super.

Refs #21581.
2014-01-11 08:20:28 -05:00
Aymeric Augustin 1716b7ce5a Renamed AppCache to Apps.
Also renamed app_cache to apps and "app cache" to "app registry".

Deprecated AppCache.app_cache_ready() in favor of Apps.ready().
2013-12-24 12:25:17 +01:00
Aymeric Augustin 2fef9e5375 Moved apps back in the toplevel django namespace.
Reverted 4a56a93cc4.
2013-12-22 11:39:55 +01:00
Aymeric Augustin 65cd74be8e Stopped iterating on INSTALLED_APPS.
Used the app cache's get_app_configs() method instead.
2013-12-22 11:39:18 +01:00
Bouke Haarsma 9b7455e918 Fixed #21351 -- Replaced memoize with Python's lru_cache.
Replaced the custom, untested memoize with a similar decorator from Python's
3.2 stdlib. Although some minor performance degradation (see ticket), it is
expected that in the long run lru_cache will outperform memoize once it is
implemented in C.

Thanks to EvilDMP for the report and Baptiste Mispelon for the idea of
replacing memoize with lru_cache.
2013-11-11 08:53:09 +01:00
Gregor MacGregor b2b763448f Fixed #20841 -- Added messages to NotImplementedErrors
Thanks joseph at vertstudios.com for the suggestion.
2013-09-10 11:09:59 -04:00
Curtis Maloney 07876cf02b Deprecated SortedDict (replaced with collections.OrderedDict)
Thanks Loic Bistuer for the review.
2013-08-04 07:09:39 -04:00
Ramiro Morales 0fa8d43e74 Replaced `and...or...` constructs with PEP 308 conditional expressions. 2013-05-26 23:47:50 -03:00
Claude Paroz 7c5b244826 Fixed #17061 -- Factored out importing object from a dotted path
Thanks Carl Meyer for the report.
2013-02-04 16:38:25 +01:00
Aymeric Augustin ee191715ea [py3] Fixed access to dict keys/values/items. 2012-08-07 12:00:22 +02:00
Claude Paroz 3904b74a3f Fixed #18013 -- Use the new 'as' syntax for exceptions.
Thanks Clueless for the initial patch.
Note that unittest has been purposely left out (external package only used by Python 2.6).
2012-04-29 20:57:15 +02:00
Jannis Leidel c4cc875643 Fixed #16703 -- Raise an exception if the storage location of the DefaultStorageFinder is empty.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16863 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-09-21 15:58:32 +00:00
Jannis Leidel 1d32bdd3c9 Fixed #15252 -- Added static template tag and CachedStaticFilesStorage to staticfiles contrib app.
Many thanks to Florian Apolloner and Jacob Kaplan-Moss for reviewing and eagle eyeing.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16594 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-08-11 14:07:39 +00:00
Chris Beaven c47b69ba53 Fix the docstring of contrib.staticfiles BaseFinder so it's not misleading.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15771 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-03-07 22:54:55 +00:00
Jannis Leidel 3bff7ed34c Preserve order of STATICFILES_DIRS locations in FileSystemFinder.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15389 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-02-01 20:10:29 +00:00
Carl Meyer 7aad3d3fa8 Fixed #15094 - Added check for forgetting trailing comma in STATICFILES_DIRS tuple. Also reorganized staticfiles settings-checks for better consistency.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15386 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-02-01 14:57:10 +00:00
Carl Meyer 76fb2bb0e2 Fixed some documentation and default-settings.py comments that were misleading about the purpose of STATIC_ROOT, and removed an unused import.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15384 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-02-01 14:28:07 +00:00
Jannis Leidel 9e81e18929 Uses a SortedDict for memoization of staticfiles finder instances to preserve order during tests.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15371 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-30 17:23:36 +00:00
Jannis Leidel 645eb2b26b Stopped staticfiles app from requiring a models module when looking for static files. Also removed a bit of code smell in the prefix handling by saving it in the source file storage.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15219 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-15 23:38:00 +00:00
Jannis Leidel 465833834c Fixed a few docstrings and other helper texts in the staticfiles app.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15148 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-05 12:41:40 +00:00
Jannis Leidel e45d1e2dac Safely join paths in staticfiles finder.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15127 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-02 01:31:55 +00:00
Jannis Leidel 0de63c96f2 Fixed #14961 -- Revised staticfiles's prefix handling to make sure it runs on Windows. Also revised staticfiles tests to pass on Windows.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15119 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-12-31 14:22:32 +00:00
Jannis Leidel 58af951c30 Fixing a few cosmetic bugs. Thanks for the hint, Alex Gaynor.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14307 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-21 03:16:58 +00:00
Jannis Leidel cfc19f84de Fixed #12323 and #11582 -- Extended the ability to handle static files. Thanks to all for helping with the original app, the patch, documentation and general support.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14293 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-20 01:33:24 +00:00