Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
92e8f1f3
Kaydet (Commit)
92e8f1f3
authored
Ara 02, 2014
tarafından
Aymeric Augustin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Moved context_processors from django.core to django.template.
üst
c599f233
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
152 additions
and
134 deletions
+152
-134
global_settings.py
django/conf/global_settings.py
+6
-6
settings.py
django/conf/project_template/project_name/settings.py
+5
-5
context_processors.py
django/core/context_processors.py
+7
-82
context.py
django/template/context.py
+1
-1
context_processors.py
django/template/context_processors.py
+85
-0
deprecation.txt
docs/internals/deprecation.txt
+2
-0
staticfiles.txt
docs/ref/contrib/staticfiles.txt
+1
-1
csrf.txt
docs/ref/csrf.txt
+3
-3
settings.txt
docs/ref/settings.txt
+6
-6
api.txt
docs/ref/templates/api.txt
+19
-19
1.8.txt
docs/releases/1.8.txt
+6
-0
timezones.txt
docs/topics/i18n/timezones.txt
+1
-1
translation.txt
docs/topics/i18n/translation.txt
+2
-2
tests.py
tests/admin_views/tests.py
+1
-1
tests.py
tests/cache/tests.py
+1
-1
tests.py
tests/context_processors/tests.py
+2
-2
views.py
tests/context_processors/views.py
+1
-1
tests.py
tests/csrf_tests/tests.py
+1
-1
tests.py
tests/shortcuts/tests.py
+1
-1
tests.py
tests/timezones/tests.py
+1
-1
No files found.
django/conf/global_settings.py
Dosyayı görüntüle @
92e8f1f3
...
@@ -218,12 +218,12 @@ TEMPLATE_LOADERS = (
...
@@ -218,12 +218,12 @@ TEMPLATE_LOADERS = (
# only parameter and returns a dictionary to add to the context.
# only parameter and returns a dictionary to add to the context.
TEMPLATE_CONTEXT_PROCESSORS
=
(
TEMPLATE_CONTEXT_PROCESSORS
=
(
'django.contrib.auth.context_processors.auth'
,
'django.contrib.auth.context_processors.auth'
,
'django.
cor
e.context_processors.debug'
,
'django.
templat
e.context_processors.debug'
,
'django.
cor
e.context_processors.i18n'
,
'django.
templat
e.context_processors.i18n'
,
'django.
cor
e.context_processors.media'
,
'django.
templat
e.context_processors.media'
,
'django.
cor
e.context_processors.static'
,
'django.
templat
e.context_processors.static'
,
'django.
cor
e.context_processors.tz'
,
'django.
templat
e.context_processors.tz'
,
# 'django.
cor
e.context_processors.request',
# 'django.
templat
e.context_processors.request',
'django.contrib.messages.context_processors.messages'
,
'django.contrib.messages.context_processors.messages'
,
)
)
...
...
django/conf/project_template/project_name/settings.py
Dosyayı görüntüle @
92e8f1f3
...
@@ -60,11 +60,11 @@ TEMPLATES = [
...
@@ -60,11 +60,11 @@ TEMPLATES = [
'APP_DIRS'
:
True
,
'APP_DIRS'
:
True
,
'OPTIONS'
:
{
'OPTIONS'
:
{
'context_processors'
:
[
'context_processors'
:
[
'django.
cor
e.context_processors.debug'
,
'django.
templat
e.context_processors.debug'
,
'django.
cor
e.context_processors.i18n'
,
'django.
templat
e.context_processors.i18n'
,
'django.
cor
e.context_processors.tz'
,
'django.
templat
e.context_processors.tz'
,
'django.
cor
e.context_processors.media'
,
'django.
templat
e.context_processors.media'
,
'django.
cor
e.context_processors.static'
,
'django.
templat
e.context_processors.static'
,
'django.contrib.auth.context_processors.auth'
,
'django.contrib.auth.context_processors.auth'
,
'django.contrib.messages.context_processors.messages'
,
'django.contrib.messages.context_processors.messages'
,
],
],
...
...
django/core/context_processors.py
Dosyayı görüntüle @
92e8f1f3
"""
import
warnings
A set of request processors that return dictionaries to be merged into a
template context. Each function takes the request object as its only parameter
and returns a dictionary to add to the context.
These are referenced from the setting TEMPLATE_CONTEXT_PROCESSORS and used by
from
django.template.context_processors
import
*
# NOQA
RequestContext.
from
django.utils.deprecation
import
RemovedInDjango20Warning
"""
from
__future__
import
unicode_literals
from
django.conf
import
settings
from
django.middleware.csrf
import
get_token
from
django.utils
import
six
from
django.utils.encoding
import
smart_text
from
django.utils.functional
import
lazy
warnings
.
warn
(
def
csrf
(
request
):
"django.core.context_processors is deprecated in favor of "
"""
"django.template.context_processors."
,
Context processor that provides a CSRF token, or the string 'NOTPROVIDED' if
RemovedInDjango20Warning
,
stacklevel
=
2
)
it has not been provided by either a view decorator or the middleware
"""
def
_get_val
():
token
=
get_token
(
request
)
if
token
is
None
:
# In order to be able to provide debugging info in the
# case of misconfiguration, we use a sentinel value
# instead of returning an empty dict.
return
'NOTPROVIDED'
else
:
return
smart_text
(
token
)
_get_val
=
lazy
(
_get_val
,
six
.
text_type
)
return
{
'csrf_token'
:
_get_val
()}
def
debug
(
request
):
"""
Returns context variables helpful for debugging.
"""
context_extras
=
{}
if
settings
.
DEBUG
and
request
.
META
.
get
(
'REMOTE_ADDR'
)
in
settings
.
INTERNAL_IPS
:
context_extras
[
'debug'
]
=
True
from
django.db
import
connection
# Return a lazy reference that computes connection.queries on access,
# to ensure it contains queries triggered after this function runs.
context_extras
[
'sql_queries'
]
=
lazy
(
lambda
:
connection
.
queries
,
list
)
return
context_extras
def
i18n
(
request
):
from
django.utils
import
translation
context_extras
=
{}
context_extras
[
'LANGUAGES'
]
=
settings
.
LANGUAGES
context_extras
[
'LANGUAGE_CODE'
]
=
translation
.
get_language
()
context_extras
[
'LANGUAGE_BIDI'
]
=
translation
.
get_language_bidi
()
return
context_extras
def
tz
(
request
):
from
django.utils
import
timezone
return
{
'TIME_ZONE'
:
timezone
.
get_current_timezone_name
()}
def
static
(
request
):
"""
Adds static-related context variables to the context.
"""
return
{
'STATIC_URL'
:
settings
.
STATIC_URL
}
def
media
(
request
):
"""
Adds media-related context variables to the context.
"""
return
{
'MEDIA_URL'
:
settings
.
MEDIA_URL
}
def
request
(
request
):
return
{
'request'
:
request
}
django/template/context.py
Dosyayı görüntüle @
92e8f1f3
...
@@ -2,7 +2,7 @@ from copy import copy
...
@@ -2,7 +2,7 @@ from copy import copy
# Hard-coded processor for easier use of CSRF protection.
# Hard-coded processor for easier use of CSRF protection.
_builtin_context_processors
=
(
'django.
cor
e.context_processors.csrf'
,)
_builtin_context_processors
=
(
'django.
templat
e.context_processors.csrf'
,)
class
ContextPopException
(
Exception
):
class
ContextPopException
(
Exception
):
...
...
django/template/context_processors.py
0 → 100644
Dosyayı görüntüle @
92e8f1f3
"""
A set of request processors that return dictionaries to be merged into a
template context. Each function takes the request object as its only parameter
and returns a dictionary to add to the context.
These are referenced from the setting TEMPLATE_CONTEXT_PROCESSORS and used by
RequestContext.
"""
from
__future__
import
unicode_literals
from
django.conf
import
settings
from
django.middleware.csrf
import
get_token
from
django.utils
import
six
from
django.utils.encoding
import
smart_text
from
django.utils.functional
import
lazy
def
csrf
(
request
):
"""
Context processor that provides a CSRF token, or the string 'NOTPROVIDED' if
it has not been provided by either a view decorator or the middleware
"""
def
_get_val
():
token
=
get_token
(
request
)
if
token
is
None
:
# In order to be able to provide debugging info in the
# case of misconfiguration, we use a sentinel value
# instead of returning an empty dict.
return
'NOTPROVIDED'
else
:
return
smart_text
(
token
)
_get_val
=
lazy
(
_get_val
,
six
.
text_type
)
return
{
'csrf_token'
:
_get_val
()}
def
debug
(
request
):
"""
Returns context variables helpful for debugging.
"""
context_extras
=
{}
if
settings
.
DEBUG
and
request
.
META
.
get
(
'REMOTE_ADDR'
)
in
settings
.
INTERNAL_IPS
:
context_extras
[
'debug'
]
=
True
from
django.db
import
connection
# Return a lazy reference that computes connection.queries on access,
# to ensure it contains queries triggered after this function runs.
context_extras
[
'sql_queries'
]
=
lazy
(
lambda
:
connection
.
queries
,
list
)
return
context_extras
def
i18n
(
request
):
from
django.utils
import
translation
context_extras
=
{}
context_extras
[
'LANGUAGES'
]
=
settings
.
LANGUAGES
context_extras
[
'LANGUAGE_CODE'
]
=
translation
.
get_language
()
context_extras
[
'LANGUAGE_BIDI'
]
=
translation
.
get_language_bidi
()
return
context_extras
def
tz
(
request
):
from
django.utils
import
timezone
return
{
'TIME_ZONE'
:
timezone
.
get_current_timezone_name
()}
def
static
(
request
):
"""
Adds static-related context variables to the context.
"""
return
{
'STATIC_URL'
:
settings
.
STATIC_URL
}
def
media
(
request
):
"""
Adds media-related context variables to the context.
"""
return
{
'MEDIA_URL'
:
settings
.
MEDIA_URL
}
def
request
(
request
):
return
{
'request'
:
request
}
docs/internals/deprecation.txt
Dosyayı görüntüle @
92e8f1f3
...
@@ -44,6 +44,8 @@ details on these changes.
...
@@ -44,6 +44,8 @@ details on these changes.
:class:`~django.core.management.BaseCommand` instead, which takes no arguments
:class:`~django.core.management.BaseCommand` instead, which takes no arguments
by default.
by default.
* ``django.core.context_processors`` module will be removed.
* ``django.db.models.sql.aggregates`` module will be removed.
* ``django.db.models.sql.aggregates`` module will be removed.
* ``django.contrib.gis.db.models.sql.aggregates`` module will be removed.
* ``django.contrib.gis.db.models.sql.aggregates`` module will be removed.
...
...
docs/ref/contrib/staticfiles.txt
Dosyayı görüntüle @
92e8f1f3
...
@@ -381,7 +381,7 @@ There are a few other helpers outside of the
...
@@ -381,7 +381,7 @@ There are a few other helpers outside of the
:mod:`staticfiles <django.contrib.staticfiles>` app to work with static
:mod:`staticfiles <django.contrib.staticfiles>` app to work with static
files:
files:
- The :func:`django.
cor
e.context_processors.static` context processor
- The :func:`django.
templat
e.context_processors.static` context processor
which adds :setting:`STATIC_URL` to every template context rendered
which adds :setting:`STATIC_URL` to every template context rendered
with :class:`~django.template.RequestContext` contexts.
with :class:`~django.template.RequestContext` contexts.
...
...
docs/ref/csrf.txt
Dosyayı görüntüle @
92e8f1f3
...
@@ -46,11 +46,11 @@ To take advantage of CSRF protection in your views, follow these steps:
...
@@ -46,11 +46,11 @@ To take advantage of CSRF protection in your views, follow these steps:
that would cause the CSRF token to be leaked, leading to a vulnerability.
that would cause the CSRF token to be leaked, leading to a vulnerability.
3. In the corresponding view functions, ensure that the
3. In the corresponding view functions, ensure that the
``'django.
cor
e.context_processors.csrf'`` context processor is
``'django.
templat
e.context_processors.csrf'`` context processor is
being used. Usually, this can be done in one of two ways:
being used. Usually, this can be done in one of two ways:
1. Use RequestContext, which always uses
1. Use RequestContext, which always uses
``'django.
cor
e.context_processors.csrf'`` (no matter what your
``'django.
templat
e.context_processors.csrf'`` (no matter what your
TEMPLATE_CONTEXT_PROCESSORS setting). If you are using
TEMPLATE_CONTEXT_PROCESSORS setting). If you are using
generic views or contrib apps, you are covered already, since these
generic views or contrib apps, you are covered already, since these
apps use RequestContext throughout.
apps use RequestContext throughout.
...
@@ -58,8 +58,8 @@ To take advantage of CSRF protection in your views, follow these steps:
...
@@ -58,8 +58,8 @@ To take advantage of CSRF protection in your views, follow these steps:
2. Manually import and use the processor to generate the CSRF token and
2. Manually import and use the processor to generate the CSRF token and
add it to the template context. e.g.::
add it to the template context. e.g.::
from django.core.context_processors import csrf
from django.shortcuts import render_to_response
from django.shortcuts import render_to_response
from django.template.context_processors import csrf
def my_view(request):
def my_view(request):
c = {}
c = {}
...
...
docs/ref/settings.txt
Dosyayı görüntüle @
92e8f1f3
...
@@ -1863,7 +1863,7 @@ to a non-empty value. You will need to :ref:`configure these files to be served
...
@@ -1863,7 +1863,7 @@ to a non-empty value. You will need to :ref:`configure these files to be served
<serving-uploaded-files-in-development>` in both development and production.
<serving-uploaded-files-in-development>` in both development and production.
In order to use ``{{ MEDIA_URL }}`` in your templates, you must have
In order to use ``{{ MEDIA_URL }}`` in your templates, you must have
``'django.
cor
e.context_processors.media'`` in your
``'django.
templat
e.context_processors.media'`` in your
:setting:`TEMPLATE_CONTEXT_PROCESSORS`. It's there by default, but be sure
:setting:`TEMPLATE_CONTEXT_PROCESSORS`. It's there by default, but be sure
to include it if you override that setting and want this behavior.
to include it if you override that setting and want this behavior.
...
@@ -2382,11 +2382,11 @@ TEMPLATE_CONTEXT_PROCESSORS
...
@@ -2382,11 +2382,11 @@ TEMPLATE_CONTEXT_PROCESSORS
Default::
Default::
("django.contrib.auth.context_processors.auth",
("django.contrib.auth.context_processors.auth",
"django.
cor
e.context_processors.debug",
"django.
templat
e.context_processors.debug",
"django.
cor
e.context_processors.i18n",
"django.
templat
e.context_processors.i18n",
"django.
cor
e.context_processors.media",
"django.
templat
e.context_processors.media",
"django.
cor
e.context_processors.static",
"django.
templat
e.context_processors.static",
"django.
cor
e.context_processors.tz",
"django.
templat
e.context_processors.tz",
"django.contrib.messages.context_processors.messages")
"django.contrib.messages.context_processors.messages")
A tuple of callables that are used to populate the context in ``RequestContext``.
A tuple of callables that are used to populate the context in ``RequestContext``.
...
...
docs/ref/templates/api.txt
Dosyayı görüntüle @
92e8f1f3
...
@@ -457,15 +457,15 @@ and return a dictionary of items to be merged into the context. By default,
...
@@ -457,15 +457,15 @@ and return a dictionary of items to be merged into the context. By default,
:setting:`TEMPLATE_CONTEXT_PROCESSORS` is set to::
:setting:`TEMPLATE_CONTEXT_PROCESSORS` is set to::
("django.contrib.auth.context_processors.auth",
("django.contrib.auth.context_processors.auth",
"django.
cor
e.context_processors.debug",
"django.
templat
e.context_processors.debug",
"django.
cor
e.context_processors.i18n",
"django.
templat
e.context_processors.i18n",
"django.
cor
e.context_processors.media",
"django.
templat
e.context_processors.media",
"django.
cor
e.context_processors.static",
"django.
templat
e.context_processors.static",
"django.
cor
e.context_processors.tz",
"django.
templat
e.context_processors.tz",
"django.contrib.messages.context_processors.messages")
"django.contrib.messages.context_processors.messages")
In addition to these, ``RequestContext`` always uses
In addition to these, ``RequestContext`` always uses
``django.
cor
e.context_processors.csrf``. This is a security
``django.
templat
e.context_processors.csrf``. This is a security
related context processor required by the admin and other contrib apps, and,
related context processor required by the admin and other contrib apps, and,
in case of accidental misconfiguration, it is deliberately hardcoded in and
in case of accidental misconfiguration, it is deliberately hardcoded in and
cannot be turned off by the :setting:`TEMPLATE_CONTEXT_PROCESSORS` setting.
cannot be turned off by the :setting:`TEMPLATE_CONTEXT_PROCESSORS` setting.
...
@@ -526,10 +526,10 @@ If :setting:`TEMPLATE_CONTEXT_PROCESSORS` contains this processor, every
...
@@ -526,10 +526,10 @@ If :setting:`TEMPLATE_CONTEXT_PROCESSORS` contains this processor, every
``django.contrib.auth.context_processors.PermWrapper``, representing the
``django.contrib.auth.context_processors.PermWrapper``, representing the
permissions that the currently logged-in user has.
permissions that the currently logged-in user has.
.. currentmodule:: django.
cor
e.context_processors
.. currentmodule:: django.
templat
e.context_processors
django.
cor
e.context_processors.debug
django.
templat
e.context_processors.debug
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~
If :setting:`TEMPLATE_CONTEXT_PROCESSORS` contains this processor, every
If :setting:`TEMPLATE_CONTEXT_PROCESSORS` contains this processor, every
``RequestContext`` will contain these two variables -- but only if your
``RequestContext`` will contain these two variables -- but only if your
...
@@ -543,8 +543,8 @@ If :setting:`TEMPLATE_CONTEXT_PROCESSORS` contains this processor, every
...
@@ -543,8 +543,8 @@ If :setting:`TEMPLATE_CONTEXT_PROCESSORS` contains this processor, every
and how long it took. The list is in order by query and lazily generated
and how long it took. The list is in order by query and lazily generated
on access.
on access.
django.
cor
e.context_processors.i18n
django.
templat
e.context_processors.i18n
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~
If :setting:`TEMPLATE_CONTEXT_PROCESSORS` contains this processor, every
If :setting:`TEMPLATE_CONTEXT_PROCESSORS` contains this processor, every
``RequestContext`` will contain these two variables:
``RequestContext`` will contain these two variables:
...
@@ -555,15 +555,15 @@ If :setting:`TEMPLATE_CONTEXT_PROCESSORS` contains this processor, every
...
@@ -555,15 +555,15 @@ If :setting:`TEMPLATE_CONTEXT_PROCESSORS` contains this processor, every
See :doc:`/topics/i18n/index` for more.
See :doc:`/topics/i18n/index` for more.
django.
cor
e.context_processors.media
django.
templat
e.context_processors.media
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~
If :setting:`TEMPLATE_CONTEXT_PROCESSORS` contains this processor, every
If :setting:`TEMPLATE_CONTEXT_PROCESSORS` contains this processor, every
``RequestContext`` will contain a variable ``MEDIA_URL``, providing the
``RequestContext`` will contain a variable ``MEDIA_URL``, providing the
value of the :setting:`MEDIA_URL` setting.
value of the :setting:`MEDIA_URL` setting.
django.
cor
e.context_processors.static
django.
templat
e.context_processors.static
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~
.. function:: static
.. function:: static
...
@@ -571,15 +571,15 @@ If :setting:`TEMPLATE_CONTEXT_PROCESSORS` contains this processor, every
...
@@ -571,15 +571,15 @@ If :setting:`TEMPLATE_CONTEXT_PROCESSORS` contains this processor, every
``RequestContext`` will contain a variable ``STATIC_URL``, providing the
``RequestContext`` will contain a variable ``STATIC_URL``, providing the
value of the :setting:`STATIC_URL` setting.
value of the :setting:`STATIC_URL` setting.
django.
cor
e.context_processors.csrf
django.
templat
e.context_processors.csrf
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~
This processor adds a token that is needed by the :ttag:`csrf_token` template
This processor adds a token that is needed by the :ttag:`csrf_token` template
tag for protection against :doc:`Cross Site Request Forgeries
tag for protection against :doc:`Cross Site Request Forgeries
</ref/csrf>`.
</ref/csrf>`.
django.
cor
e.context_processors.request
django.
templat
e.context_processors.request
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~
If :setting:`TEMPLATE_CONTEXT_PROCESSORS` contains this processor, every
If :setting:`TEMPLATE_CONTEXT_PROCESSORS` contains this processor, every
``RequestContext`` will contain a variable ``request``, which is the current
``RequestContext`` will contain a variable ``request``, which is the current
...
...
docs/releases/1.8.txt
Dosyayı görüntüle @
92e8f1f3
...
@@ -1014,6 +1014,12 @@ Related to the previous item, referencing views as strings in the ``url()``
...
@@ -1014,6 +1014,12 @@ Related to the previous item, referencing views as strings in the ``url()``
function is deprecated. Pass the callable view as described in the previous
function is deprecated. Pass the callable view as described in the previous
section instead.
section instead.
``django.core.context_processors``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Built-in template context processors have been moved to
``django.template.context_processors``.
``django.test.SimpleTestCase.urls``
``django.test.SimpleTestCase.urls``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
...
docs/topics/i18n/timezones.txt
Dosyayı görüntüle @
92e8f1f3
...
@@ -311,7 +311,7 @@ time zone is unset, the default time zone applies.
...
@@ -311,7 +311,7 @@ time zone is unset, the default time zone applies.
get_current_timezone
get_current_timezone
~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~
When the ``django.
cor
e.context_processors.tz`` context processor is
When the ``django.
templat
e.context_processors.tz`` context processor is
enabled -- by default, it is -- each :class:`~django.template.RequestContext`
enabled -- by default, it is -- each :class:`~django.template.RequestContext`
contains a ``TIME_ZONE`` variable that provides the name of the current time
contains a ``TIME_ZONE`` variable that provides the name of the current time
zone.
zone.
...
...
docs/topics/i18n/translation.txt
Dosyayı görüntüle @
92e8f1f3
...
@@ -28,7 +28,7 @@ bit of i18n-related overhead in certain places of the framework. If you don't
...
@@ -28,7 +28,7 @@ bit of i18n-related overhead in certain places of the framework. If you don't
use internationalization, you should take the two seconds to set
use internationalization, you should take the two seconds to set
:setting:`USE_I18N = False <USE_I18N>` in your settings file. Then Django will
:setting:`USE_I18N = False <USE_I18N>` in your settings file. Then Django will
make some optimizations so as not to load the internationalization machinery.
make some optimizations so as not to load the internationalization machinery.
You'll probably also want to remove ``'django.
cor
e.context_processors.i18n'``
You'll probably also want to remove ``'django.
templat
e.context_processors.i18n'``
from your :setting:`TEMPLATE_CONTEXT_PROCESSORS` setting.
from your :setting:`TEMPLATE_CONTEXT_PROCESSORS` setting.
.. note::
.. note::
...
@@ -1509,7 +1509,7 @@ back to the previous page.
...
@@ -1509,7 +1509,7 @@ back to the previous page.
Make sure that the following item is in your
Make sure that the following item is in your
:setting:`TEMPLATE_CONTEXT_PROCESSORS` list in your settings file::
:setting:`TEMPLATE_CONTEXT_PROCESSORS` list in your settings file::
'django.
cor
e.context_processors.i18n'
'django.
templat
e.context_processors.i18n'
Activate this view by adding the following line to your URLconf::
Activate this view by adding the following line to your URLconf::
...
...
tests/admin_views/tests.py
Dosyayı görüntüle @
92e8f1f3
...
@@ -4344,7 +4344,7 @@ class ValidXHTMLTests(TestCase):
...
@@ -4344,7 +4344,7 @@ class ValidXHTMLTests(TestCase):
@override_settings
(
@override_settings
(
TEMPLATE_CONTEXT_PROCESSORS
=
filter
(
TEMPLATE_CONTEXT_PROCESSORS
=
filter
(
lambda
t
:
t
!=
'django.
cor
e.context_processors.i18n'
,
lambda
t
:
t
!=
'django.
templat
e.context_processors.i18n'
,
global_settings
.
TEMPLATE_CONTEXT_PROCESSORS
),
global_settings
.
TEMPLATE_CONTEXT_PROCESSORS
),
USE_I18N
=
False
,
USE_I18N
=
False
,
)
)
...
...
tests/cache/tests.py
Dosyayı görüntüle @
92e8f1f3
...
@@ -20,7 +20,6 @@ from django.core import signals
...
@@ -20,7 +20,6 @@ from django.core import signals
from
django.core.cache
import
(
cache
,
caches
,
CacheKeyWarning
,
from
django.core.cache
import
(
cache
,
caches
,
CacheKeyWarning
,
InvalidCacheBackendError
,
DEFAULT_CACHE_ALIAS
,
get_cache
,
InvalidCacheBackendError
,
DEFAULT_CACHE_ALIAS
,
get_cache
,
close_caches
)
close_caches
)
from
django.core.context_processors
import
csrf
from
django.db
import
connection
,
connections
,
transaction
from
django.db
import
connection
,
connections
,
transaction
from
django.core.cache.utils
import
make_template_fragment_key
from
django.core.cache.utils
import
make_template_fragment_key
from
django.http
import
HttpResponse
,
StreamingHttpResponse
from
django.http
import
HttpResponse
,
StreamingHttpResponse
...
@@ -28,6 +27,7 @@ from django.middleware.cache import (FetchFromCacheMiddleware,
...
@@ -28,6 +27,7 @@ from django.middleware.cache import (FetchFromCacheMiddleware,
UpdateCacheMiddleware
,
CacheMiddleware
)
UpdateCacheMiddleware
,
CacheMiddleware
)
from
django.middleware.csrf
import
CsrfViewMiddleware
from
django.middleware.csrf
import
CsrfViewMiddleware
from
django.template
import
Template
from
django.template
import
Template
from
django.template.context_processors
import
csrf
from
django.template.response
import
TemplateResponse
from
django.template.response
import
TemplateResponse
from
django.test
import
TestCase
,
TransactionTestCase
,
RequestFactory
,
override_settings
from
django.test
import
TestCase
,
TransactionTestCase
,
RequestFactory
,
override_settings
from
django.test.signals
import
setting_changed
from
django.test.signals
import
setting_changed
...
...
tests/context_processors/tests.py
Dosyayı görüntüle @
92e8f1f3
...
@@ -7,7 +7,7 @@ from django.test import TestCase, override_settings
...
@@ -7,7 +7,7 @@ from django.test import TestCase, override_settings
@override_settings
(
ROOT_URLCONF
=
'context_processors.urls'
)
@override_settings
(
ROOT_URLCONF
=
'context_processors.urls'
)
class
RequestContextProcessorTests
(
TestCase
):
class
RequestContextProcessorTests
(
TestCase
):
"""
"""
Tests for the ``django.
cor
e.context_processors.request`` processor.
Tests for the ``django.
templat
e.context_processors.request`` processor.
"""
"""
def
test_request_attributes
(
self
):
def
test_request_attributes
(
self
):
...
@@ -38,7 +38,7 @@ class RequestContextProcessorTests(TestCase):
...
@@ -38,7 +38,7 @@ class RequestContextProcessorTests(TestCase):
@override_settings
(
ROOT_URLCONF
=
'context_processors.urls'
,
DEBUG
=
True
,
INTERNAL_IPS
=
(
'127.0.0.1'
,))
@override_settings
(
ROOT_URLCONF
=
'context_processors.urls'
,
DEBUG
=
True
,
INTERNAL_IPS
=
(
'127.0.0.1'
,))
class
DebugContextProcessorTests
(
TestCase
):
class
DebugContextProcessorTests
(
TestCase
):
"""
"""
Tests for the ``django.
cor
e.context_processors.debug`` processor.
Tests for the ``django.
templat
e.context_processors.debug`` processor.
"""
"""
def
test_debug
(
self
):
def
test_debug
(
self
):
...
...
tests/context_processors/views.py
Dosyayı görüntüle @
92e8f1f3
from
django.core
import
context_processors
from
django.shortcuts
import
render_to_response
from
django.shortcuts
import
render_to_response
from
django.template
import
context_processors
from
django.template.context
import
RequestContext
from
django.template.context
import
RequestContext
from
.models
import
DebugObject
from
.models
import
DebugObject
...
...
tests/csrf_tests/tests.py
Dosyayı görüntüle @
92e8f1f3
...
@@ -3,10 +3,10 @@ from __future__ import unicode_literals
...
@@ -3,10 +3,10 @@ from __future__ import unicode_literals
import
logging
import
logging
from
django.conf
import
settings
from
django.conf
import
settings
from
django.core.context_processors
import
csrf
from
django.http
import
HttpRequest
,
HttpResponse
from
django.http
import
HttpRequest
,
HttpResponse
from
django.middleware.csrf
import
CsrfViewMiddleware
,
CSRF_KEY_LENGTH
from
django.middleware.csrf
import
CsrfViewMiddleware
,
CSRF_KEY_LENGTH
from
django.template
import
RequestContext
,
Template
from
django.template
import
RequestContext
,
Template
from
django.template.context_processors
import
csrf
from
django.test
import
TestCase
,
override_settings
from
django.test
import
TestCase
,
override_settings
from
django.views.decorators.csrf
import
csrf_exempt
,
requires_csrf_token
,
ensure_csrf_cookie
from
django.views.decorators.csrf
import
csrf_exempt
,
requires_csrf_token
,
ensure_csrf_cookie
...
...
tests/shortcuts/tests.py
Dosyayı görüntüle @
92e8f1f3
...
@@ -4,7 +4,7 @@ from django.test import TestCase, override_settings
...
@@ -4,7 +4,7 @@ from django.test import TestCase, override_settings
@override_settings
(
@override_settings
(
TEMPLATE_CONTEXT_PROCESSORS
=
(
'django.
cor
e.context_processors.static'
,),
TEMPLATE_CONTEXT_PROCESSORS
=
(
'django.
templat
e.context_processors.static'
,),
STATIC_URL
=
'/path/to/static/media/'
,
STATIC_URL
=
'/path/to/static/media/'
,
ROOT_URLCONF
=
'shortcuts.urls'
,
ROOT_URLCONF
=
'shortcuts.urls'
,
)
)
...
...
tests/timezones/tests.py
Dosyayı görüntüle @
92e8f1f3
...
@@ -932,7 +932,7 @@ class TemplateTests(TestCase):
...
@@ -932,7 +932,7 @@ class TemplateTests(TestCase):
@skipIf
(
sys
.
platform
.
startswith
(
'win'
),
"Windows uses non-standard time zone names"
)
@skipIf
(
sys
.
platform
.
startswith
(
'win'
),
"Windows uses non-standard time zone names"
)
def
test_tz_template_context_processor
(
self
):
def
test_tz_template_context_processor
(
self
):
"""
"""
Test the django.
cor
e.context_processors.tz template context processor.
Test the django.
templat
e.context_processors.tz template context processor.
"""
"""
tpl
=
Template
(
"{{ TIME_ZONE }}"
)
tpl
=
Template
(
"{{ TIME_ZONE }}"
)
self
.
assertEqual
(
tpl
.
render
(
Context
()),
""
)
self
.
assertEqual
(
tpl
.
render
(
Context
()),
""
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment