Commit Graph

44 Commits

Author SHA1 Message Date
Preston Timmons 655f524915 Fixed #17085, #24783 -- Refactored template library registration.
* Converted the ``libraries`` and ``builtins`` globals of
  ``django.template.base`` into properties of the Engine class.
* Added a public API for explicit registration of libraries and builtins.
2015-05-21 09:12:06 -05:00
Aymeric Augustin ed83881e64 Fixed #23820 -- Supported per-database time zone.
The primary use case is to interact with a third-party database (not
primarily managed by Django) that doesn't support time zones and where
datetimes are stored in local time when USE_TZ is True.

Configuring a PostgreSQL database with the TIME_ZONE option while USE_TZ
is False used to result in silent data corruption. Now this is an error.
2015-05-17 09:40:28 +02:00
Aymeric Augustin 15b711b5ee Deprecated TEMPLATE_DEBUG setting. 2015-02-15 20:47:04 +01: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
Aymeric Augustin 1acfd624d6 Added initial support for loading template engines. 2014-12-28 16:08:31 +01:00
Collin Anderson 5dddd79433 Fixed #20349 -- Moved setting_changed signal to django.core.signals.
This removes the need to load django.test when not testing.
2014-12-24 07:18:43 -05:00
wrwrwr e6f19ec322 Fixed #23933 -- Made override_settings(DATABASE_ROUTERS) affect the master router. 2014-12-01 11:30:50 -05:00
Aymeric Augustin 6294bd3903 Encapsulated TEMPLATE_DEBUG in Engine. 2014-11-23 11:54:17 +01:00
Aymeric Augustin 37505b6397 Encapsulated TEMPLATE_CONTEXT_PROCESSORS in Engine.
Since RequestContext doesn't know its Engine until it's passed to
Template.render() -- and cannot without breaking a widely used public
API -- an elaborate hack is required to apply context processors.
2014-11-23 11:53:18 +01:00
Aymeric Augustin a2dd08666c Removed dependency of template loaders on Django settings. 2014-11-23 11:52:14 +01:00
Aymeric Augustin 29a977ab14 Moved template loaders management in Engine.
Passed the engine instance to loaders. This is a prerequisite for
looking up configuration on the engine instance instead of global
settings.

This is backwards incompatible for custom template loaders that override
__init__. However the documentation doesn't talk about __init__ and the
way to pass arguments to custom template loaders isn't specified. I'm
considering it a private API.
2014-11-23 11:52:12 +01:00
Aymeric Augustin 572cdb4391 Introduced a template engine class.
Moved Django templates loading infrastructure there.
2014-11-23 09:29:53 +01:00
Aymeric Augustin f88ad710fa Simplified caching of template context processors. 2014-11-19 21:35:39 +01:00
Aymeric Augustin a97e72aaab Simplified caching of templatetags modules. 2014-11-19 21:35:39 +01:00
Aymeric Augustin e23240474b Simplified caching of get_default_timezone(). 2014-11-19 21:35:39 +01:00
Aymeric Augustin 9eeb788cfb Refactored getting the list of template loaders.
This provides the opportunity to move utility functions specific to the
Django Template Language outside of django.template.loader.
2014-11-16 21:41:44 +01:00
Aymeric Augustin d58597a7b8 Refactored listing template subdirectories in apps.
This change has the nice side effect of removing code that ran at import
time and depended on the app registry at module level -- a notorious
cause of AppRegistryNotReady exceptions.
2014-11-16 21:28:43 +01:00
Duncan Parkes 88b6cf4ae4 Fixed #23600 -- Made default_storage aware of more settings changes.
Added MEDIA_URL, FILE_UPLOAD_PERMISSIONS, and
FILE_UPLOAD_DIRECTORY_PERMISSIONS to the list of settings.
2014-10-08 18:10:47 -04:00
Thomas Chaumeny b2aad7b836 Replaced set([foo, ...]) by {foo, ...} literals. Refs PR 3282.
Thanks Collin Anderson for the review.
2014-09-29 00:01:38 +07:00
Loic Bistuer 942556df2f Fixed #22572 -- override_settings(ROOT_URLCONF) didn't clear urlresolvers._urlconfs.
Thanks Anubhav Joshi and Tim Graham for the reviews.
2014-05-05 19:29:27 +07:00
Rodolfo Carvalho 0d91225892 Fixed many typos in comments and docstrings.
Thanks Piotr Kasprzyk for help with the patch.
2014-03-03 07:38:09 -05:00
Chris Wilson 65131911db Fixed #21518 -- Made override_settings(ROOT_URLCONF) clear the resolver cache.
Thanks Aymeric Augustin and Simon Charette for reviews.
2014-02-07 15:29:25 -05:00
Aymeric Augustin b87bc461c8 Removed TransRealMixin.
Fixed #21688. Refs https://github.com/django/django/pull/1147.
2014-01-27 22:02:07 +01:00
Aymeric Augustin 3145ae06be Minor cleanup. 2014-01-27 22:01:22 +01:00
Aymeric Augustin f17d00278e Wiped get_commands() cache when INSTALLED_APPS changes.
Refs #21018, #21688.
2014-01-01 18:11:09 +01:00
Florian Apolloner 98b52ae201 Cleared global templatetags module cache.
TOOOOO MUCH GLOBAL STATE (you didn't see that).
2013-12-29 19:17:25 +01:00
Florian Apolloner 6aa1a31660 Properly app_template_dirs when INSTALLED_APPS change. 2013-12-27 11:17:25 +01:00
Aymeric Augustin 5891990b6e Refactored INSTALLED_APPS overrides.
* Introduced [un]set_installed_apps to handle changes to the
  INSTALLED_APPS setting.
* Refactored [un]set_available_apps to share its implementation
  with [un]set_installed_apps.
* Implemented a receiver to clear some app-related caches.
* Removed test_missing_app as it is basically impossible to reproduce
  this situation with public methods of the new app cache.
2013-12-23 20:15:08 +01:00
Aymeric Augustin 517c24bcfa Complained on override_settings(INSTALLED_APPS=...).
Currently such overrides aren't reflected in the app cache.

It would  be possible to handle them. But that doesn't look like a very
good API. It makes it complicated to express "add this app" and "remove
this app", which are the most common operations on INSTALLED_APPS.
2013-12-22 11:39:18 +01:00
Aymeric Augustin eabc3b6c8d Set stacklevel for the override_settings warning.
Refs #19031.
2013-12-20 11:09:06 +01:00
Curtis Maloney ffc37e2343 Fixed #21012 -- New API to access cache backends.
Thanks Curtis Malony and Florian Apolloner.

Squashed commit of the following:

commit 3380495e93
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sat Nov 23 14:18:07 2013 +0100

    Looked up the template_fragments cache at runtime.

commit 905a74f52b
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sat Nov 23 14:19:48 2013 +0100

    Removed all uses of create_cache.

    Refactored the cache tests significantly.

    Made it safe to override the CACHES setting.

commit 35e289fe92
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sat Nov 23 12:23:57 2013 +0100

    Removed create_cache function.

commit 8e274f747a
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sat Nov 23 12:04:52 2013 +0100

    Updated docs to describe a simplified cache backend API.

commit ee7eb0f73e
Author: Curtis Maloney <curtis@tinbrain.net>
Date:   Sat Oct 19 09:49:24 2013 +1100

    Fixed #21012 -- Thread-local caches, like databases.
2013-11-23 15:06:59 +01:00
Joeri Bekker 66f3d57b79 Fixed #19031 -- Added a warning when using override_settings with 'DATABASES' 2013-07-12 07:10:18 -04:00
Claude Paroz 9a02851340 Fixed #17744 -- Reset default file storage with setting_changed signal 2012-10-30 22:23:28 +01:00
Claude Paroz c7f44ae085 Fixed #17948 -- Isolated auth tests from custom template loaders
Thanks andrey@kostenko.name for the report.
2012-09-15 21:39:08 +02:00
Claude Paroz 4353a6163c Fixed #18196 -- Improved loaddata error messages. 2012-08-21 21:52:25 +02:00
Claude Paroz 32a4df6c55 Fixed #18395 -- Reset language-related global variables with setting_changed 2012-07-21 13:49:07 +02:00
Aymeric Augustin a15cfb2e45 Simplified timezones tests with settings_changed.
All relevant state is now properly reset whenever TIME_ZONE or USE_TZ
are changed in tests.
2012-04-29 16:03:46 +02:00
Claude Paroz 883c38c499 Fixed #17848 -- Added setting_changed signal for cases when TEMPLATE_CONTEXT_PROCESSORS is overriden in tests.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17885 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-04-09 13:24:57 +00:00
Aymeric Augustin 3ef55dfaa0 Fixed #17882 (again) -- Updated the database connections' time zone when time-zone-related settings are changed in tests.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17709 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-03-13 23:29:15 +00:00
Aymeric Augustin aa900c39a8 Fixed #17882 -- Reopened the database connection when a test changes time zone settings. Thanks brodie for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17699 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-03-13 06:59:04 +00:00
Jannis Leidel a3a53e0b73 Fixed #15561 -- Extended test setting override code added in r16165 with a decorator and a signal for setting changes.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16237 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-05-18 12:08:53 +00:00
Jacob Kaplan-Moss 34a3bd5225 Major refactoring of django.dispatch with an eye towards speed. The net result is that signals are up to 90% faster.
Though some attempts and backwards-compatibility were made, speed trumped compatibility. Thus, as usual, check BackwardsIncompatibleChanges for the complete list of backwards-incompatible changes.

Thanks to Jeremy Dunck and Keith Busell for the bulk of the work; some ideas from Brian Herring's previous work (refs #4561) were incorporated.

Documentation is, sigh, still forthcoming.

Fixes #6814 and #3951 (with the new dispatch_uid argument to connect).


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8223 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-06 15:32:46 +00:00
Russell Keith-Magee d043200077 Refs #2333 - Re-added the template rendering signal for testing purposes; however, the signal is not available during normal operation. It is only added as part of an instrumentation step that occurs during test framework setup. Previous attempt (r3659) was reverted (r3666) due to performance concerns.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3707 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-09-02 09:26:24 +00:00