Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: Eksmo/django
...
head fork: Eksmo/django
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 6 files changed
  • 0 commit comments
  • 1 contributor
View
4 django/contrib/auth/tests/models.py
@@ -18,7 +18,7 @@ def tearDown(self):
otherwise the old value is restored"""
if self.old_AUTH_PROFILE_MODULE is None and \
hasattr(settings, 'AUTH_PROFILE_MODULE'):
- del settings.AUTH_PROFILE_MODULE
+ settings.AUTH_PROFILE_MODULE = None
if self.old_AUTH_PROFILE_MODULE is not None:
settings.AUTH_PROFILE_MODULE = self.old_AUTH_PROFILE_MODULE
@@ -26,7 +26,7 @@ def tearDown(self):
def test_site_profile_not_available(self):
# calling get_profile without AUTH_PROFILE_MODULE set
if hasattr(settings, 'AUTH_PROFILE_MODULE'):
- del settings.AUTH_PROFILE_MODULE
+ settings.AUTH_PROFILE_MODULE = None
user = User.objects.get(username='testclient')
self.assertRaises(SiteProfileNotAvailable, user.get_profile)
View
7 django/contrib/auth/tests/views.py
@@ -11,6 +11,7 @@
from django.http import QueryDict
from django.utils.encoding import force_unicode
from django.utils.html import escape
+from django.template import loader
from django.test import TestCase
from django.test.utils import override_settings
@@ -35,11 +36,17 @@ def setUp(self):
settings.TEMPLATE_DIRS = (
os.path.join(os.path.dirname(__file__), 'templates'),
)
+ self.old_TEMPLATE_LOADERS = settings.TEMPLATE_LOADERS
+ settings.TEMPLATE_LOADERS = ('django.template.loaders.filesystem.Loader',
+ 'django.template.loaders.app_directories.Loader')
+ loader.template_source_loaders = None #Flushing loader cache
def tearDown(self):
settings.LANGUAGES = self.old_LANGUAGES
settings.LANGUAGE_CODE = self.old_LANGUAGE_CODE
settings.TEMPLATE_DIRS = self.old_TEMPLATE_DIRS
+ settings.TEMPLATE_LOADERS = self.old_TEMPLATE_LOADERS
+ loader.template_source_loaders = None #Flushing loader cache
def login(self, password='password'):
response = self.client.post('/login/', {
View
9 django/contrib/flatpages/tests/csrf.py
@@ -2,6 +2,8 @@
from django.conf import settings
from django.contrib.auth.models import User
from django.test import TestCase, Client
+from django.template import loader
+
class FlatpageCSRFTests(TestCase):
fixtures = ['sample_flatpages']
@@ -23,6 +25,10 @@ def setUp(self):
'templates'
),
)
+ self.old_TEMPLATE_LOADERS = settings.TEMPLATE_LOADERS
+ settings.TEMPLATE_LOADERS = ('django.template.loaders.filesystem.Loader',
+ 'django.template.loaders.app_directories.Loader')
+ loader.template_source_loaders = None
self.old_LOGIN_URL = settings.LOGIN_URL
settings.LOGIN_URL = '/accounts/login/'
@@ -30,6 +36,9 @@ def tearDown(self):
settings.MIDDLEWARE_CLASSES = self.old_MIDDLEWARE_CLASSES
settings.TEMPLATE_DIRS = self.old_TEMPLATE_DIRS
settings.LOGIN_URL = self.old_LOGIN_URL
+ settings.TEMPLATE_LOADERS = self.old_TEMPLATE_LOADERS
+ loader.template_source_loaders = None
+
def test_view_flatpage(self):
"A flatpage can be served through a view, even when the middleware is in use"
View
14 django/contrib/flatpages/tests/middleware.py
@@ -3,6 +3,8 @@
from django.contrib.auth.models import User
from django.contrib.flatpages.models import FlatPage
from django.test import TestCase
+from django.template import loader
+
class FlatpageMiddlewareTests(TestCase):
fixtures = ['sample_flatpages']
@@ -22,11 +24,17 @@ def setUp(self):
)
self.old_LOGIN_URL = settings.LOGIN_URL
settings.LOGIN_URL = '/accounts/login/'
+ self.old_TEMPLATE_LOADERS = settings.TEMPLATE_LOADERS
+ settings.TEMPLATE_LOADERS = ('django.template.loaders.filesystem.Loader',
+ 'django.template.loaders.app_directories.Loader')
+ loader.template_source_loaders = None
def tearDown(self):
settings.MIDDLEWARE_CLASSES = self.old_MIDDLEWARE_CLASSES
settings.TEMPLATE_DIRS = self.old_TEMPLATE_DIRS
settings.LOGIN_URL = self.old_LOGIN_URL
+ settings.TEMPLATE_LOADERS = self.old_TEMPLATE_LOADERS
+ loader.template_source_loaders = None
def test_view_flatpage(self):
"A flatpage can be served through a view, even when the middleware is in use"
@@ -106,12 +114,18 @@ def setUp(self):
settings.LOGIN_URL = '/accounts/login/'
self.old_APPEND_SLASH = settings.APPEND_SLASH
settings.APPEND_SLASH = True
+ self.old_TEMPLATE_LOADERS = settings.TEMPLATE_LOADERS
+ settings.TEMPLATE_LOADERS = ('django.template.loaders.filesystem.Loader',
+ 'django.template.loaders.app_directories.Loader')
+ loader.template_source_loaders = None
def tearDown(self):
settings.MIDDLEWARE_CLASSES = self.old_MIDDLEWARE_CLASSES
settings.TEMPLATE_DIRS = self.old_TEMPLATE_DIRS
settings.LOGIN_URL = self.old_LOGIN_URL
settings.APPEND_SLASH = self.old_APPEND_SLASH
+ settings.TEMPLATE_LOADERS = self.old_TEMPLATE_LOADERS
+ loader.template_source_loaders = None
def test_redirect_view_flatpage(self):
"A flatpage can be served through a view and should add a slash"
View
13 django/contrib/flatpages/tests/views.py
@@ -3,6 +3,7 @@
from django.contrib.auth.models import User
from django.contrib.flatpages.models import FlatPage
from django.test import TestCase
+from django.template import loader
class FlatpageViewTests(TestCase):
fixtures = ['sample_flatpages']
@@ -20,6 +21,10 @@ def setUp(self):
'templates'
),
)
+ self.old_TEMPLATE_LOADERS = settings.TEMPLATE_LOADERS
+ settings.TEMPLATE_LOADERS = ('django.template.loaders.filesystem.Loader',
+ 'django.template.loaders.app_directories.Loader')
+ loader.template_source_loaders = None
self.old_LOGIN_URL = settings.LOGIN_URL
settings.LOGIN_URL = '/accounts/login/'
@@ -27,6 +32,8 @@ def tearDown(self):
settings.MIDDLEWARE_CLASSES = self.old_MIDDLEWARE_CLASSES
settings.TEMPLATE_DIRS = self.old_TEMPLATE_DIRS
settings.LOGIN_URL = self.old_LOGIN_URL
+ settings.TEMPLATE_LOADERS = self.old_TEMPLATE_LOADERS
+ loader.template_source_loaders = None
def test_view_flatpage(self):
"A flatpage can be served through a view"
@@ -95,12 +102,18 @@ def setUp(self):
settings.LOGIN_URL = '/accounts/login/'
self.old_APPEND_SLASH = settings.APPEND_SLASH
settings.APPEND_SLASH = True
+ self.old_TEMPLATE_LOADERS = settings.TEMPLATE_LOADERS
+ settings.TEMPLATE_LOADERS = ('django.template.loaders.filesystem.Loader',
+ 'django.template.loaders.app_directories.Loader')
+ loader.template_source_loaders = None
def tearDown(self):
settings.MIDDLEWARE_CLASSES = self.old_MIDDLEWARE_CLASSES
settings.TEMPLATE_DIRS = self.old_TEMPLATE_DIRS
settings.LOGIN_URL = self.old_LOGIN_URL
settings.APPEND_SLASH = self.old_APPEND_SLASH
+ settings.TEMPLATE_LOADERS = self.old_TEMPLATE_LOADERS
+ loader.template_source_loaders = None
def test_redirect_view_flatpage(self):
"A flatpage can be served through a view and should add a slash"
View
5 django/core/management/base.py
@@ -247,8 +247,9 @@ def execute(self, *args, **options):
else:
self.stderr.write(smart_str(self.style.ERROR('Error: %s\n' % e)))
sys.exit(1)
- if saved_lang is not None:
- translation.activate(saved_lang)
+ finally:
+ if saved_lang is not None:
+ translation.activate(saved_lang)
def validate(self, app=None, display_num_errors=False):
"""

No commit comments for this range

Something went wrong with that request. Please try again.