[Python-modules-commits] [python-django] 01/04: Import python-django_1.9.7.orig.tar.bz2
Chris Lamb
lamby at moszumanska.debian.org
Sat Jun 25 17:34:50 UTC 2016
This is an automated email from the git hooks/post-receive script.
lamby pushed a commit to branch debian/patched-master
in repository python-django.
commit 7e6169dbba5114363e20f736e4d2b8d00cbb4abc
Author: Chris Lamb <lamby at debian.org>
Date: Mon Jun 6 11:57:33 2016 +0100
Import python-django_1.9.7.orig.tar.bz2
---
AUTHORS | 2 +
Django.egg-info/PKG-INFO | 2 +-
Django.egg-info/SOURCES.txt | 1 +
PKG-INFO | 2 +-
django/__init__.py | 2 +-
django/contrib/admin/sites.py | 1 +
django/contrib/admin/templates/admin/login.html | 2 +-
django/contrib/auth/password_validation.py | 6 +-
django/contrib/gis/templates/gis/openlayers.html | 4 +-
django/contrib/postgres/forms/hstore.py | 12 +++-
django/db/backends/base/base.py | 11 ++-
django/db/backends/base/operations.py | 4 +-
django/db/backends/postgresql/client.py | 18 ++---
django/db/models/expressions.py | 2 +-
django/db/models/fields/related_descriptors.py | 4 +-
django/db/models/fields/related_lookups.py | 11 +--
django/http/utils.py | 2 +-
django/middleware/csrf.py | 2 +-
django/template/defaultfilters.py | 4 +-
django/template/loaders/cached.py | 4 +-
django/utils/cache.py | 2 +-
django/utils/http.py | 6 +-
django/views/defaults.py | 2 +-
docs/conf.py | 3 +
docs/howto/custom-lookups.txt | 6 +-
docs/howto/custom-management-commands.txt | 6 +-
docs/howto/deployment/checklist.txt | 2 +-
docs/howto/error-reporting.txt | 10 +--
docs/howto/outputting-csv.txt | 2 +-
docs/howto/static-files/deployment.txt | 6 +-
docs/internals/contributing/committing-code.txt | 2 +-
docs/internals/contributing/index.txt | 2 +-
.../writing-code/submitting-patches.txt | 2 +-
.../contributing/writing-documentation.txt | 9 ---
docs/intro/contributing.txt | 3 +-
docs/intro/overview.txt | 16 ++---
docs/intro/reusable-apps.txt | 6 +-
docs/intro/tutorial01.txt | 15 ++--
docs/intro/tutorial05.txt | 24 +++----
docs/intro/whatsnext.txt | 2 +-
docs/ref/class-based-views/base.txt | 6 +-
docs/ref/contrib/admin/index.txt | 33 +++++----
docs/ref/contrib/contenttypes.txt | 37 ++++------
docs/ref/contrib/gis/db-api.txt | 4 +-
docs/ref/contrib/gis/layermapping.txt | 2 +-
docs/ref/contrib/gis/tutorial.txt | 11 +--
docs/ref/contrib/index.txt | 8 +--
docs/ref/contrib/messages.txt | 9 +--
docs/ref/contrib/sites.txt | 10 ++-
docs/ref/csrf.txt | 40 +++++------
docs/ref/django-admin.txt | 9 +++
docs/ref/files/file.txt | 11 +++
docs/ref/forms/fields.txt | 23 ++++--
docs/ref/forms/widgets.txt | 10 ++-
docs/ref/models/expressions.txt | 5 +-
docs/ref/models/fields.txt | 50 ++++++++++---
docs/ref/models/instances.txt | 28 ++++----
docs/ref/models/querysets.txt | 30 +++++---
docs/ref/models/relations.txt | 5 +-
docs/ref/request-response.txt | 24 +++----
docs/ref/settings.txt | 27 +++----
docs/ref/templates/builtins.txt | 7 +-
docs/ref/utils.txt | 41 ++++++-----
docs/ref/views.txt | 6 +-
docs/releases/1.0.txt | 2 +-
docs/releases/1.1.txt | 9 ++-
docs/releases/1.2.txt | 18 ++---
docs/releases/1.3.txt | 32 +++------
docs/releases/1.4.txt | 28 ++++----
docs/releases/1.5.txt | 24 +++----
docs/releases/1.6.txt | 24 +++----
docs/releases/1.7.txt | 22 +++---
docs/releases/1.8.txt | 24 +++----
docs/releases/1.9.7.txt | 31 ++++++++
docs/releases/1.9.txt | 20 +++---
docs/releases/index.txt | 1 +
docs/topics/auth/customizing.txt | 11 +--
docs/topics/auth/default.txt | 8 ++-
docs/topics/cache.txt | 84 +++++++++-------------
docs/topics/conditional-view-processing.txt | 12 ++--
docs/topics/db/aggregation.txt | 1 +
docs/topics/db/examples/one_to_one.txt | 1 -
docs/topics/db/models.txt | 28 +++++++-
docs/topics/db/queries.txt | 19 +++--
docs/topics/email.txt | 66 ++++++++++++-----
docs/topics/files.txt | 5 +-
docs/topics/forms/modelforms.txt | 29 +++++---
docs/topics/http/file-uploads.txt | 51 ++++++++++++-
docs/topics/http/sessions.txt | 12 ----
docs/topics/http/shortcuts.txt | 8 +--
docs/topics/http/urls.txt | 2 +-
docs/topics/i18n/timezones.txt | 5 +-
docs/topics/i18n/translation.txt | 13 ++--
docs/topics/logging.txt | 15 ++--
docs/topics/python3.txt | 8 +--
docs/topics/serialization.txt | 6 +-
docs/topics/settings.txt | 4 +-
docs/topics/testing/overview.txt | 2 +-
docs/topics/testing/tools.txt | 16 +++--
tests/admin_views/tests.py | 17 ++++-
tests/auth_tests/test_forms.py | 18 +++++
tests/dbshell/test_postgresql_psycopg2.py | 48 ++++++-------
tests/gis_tests/test_geoip.py | 2 +-
tests/i18n/test_extraction.py | 4 +-
tests/one_to_one/models.py | 6 +-
tests/one_to_one/tests.py | 10 ++-
tests/postgres_tests/test_hstore.py | 7 ++
tests/schema/tests.py | 2 +-
tests/template_tests/test_loaders.py | 10 +++
tests/transaction_hooks/tests.py | 14 ++++
110 files changed, 845 insertions(+), 592 deletions(-)
diff --git a/AUTHORS b/AUTHORS
index 9975abf..c7bb924 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -105,6 +105,7 @@ answer newbie questions, and generally made Django that much better:
Bojan Mihelac <bmihelac at mihelac.org>
Bouke Haarsma <bouke at haarsma.eu>
Božidar Benko <bbenko at gmail.com>
+ Brad Melin <melinbrad at gmail.com>
Brant Harris
Brendan Hayward <brendanhayward85 at gmail.com>
Brenton Simpson <http://theillustratedlife.com>
@@ -181,6 +182,7 @@ answer newbie questions, and generally made Django that much better:
Danilo Bargen
Dan Johnson <danj.py at gmail.com>
Dan Poirier <poirier at pobox.com>
+ Dan Stephenson <http://dan.io/>
Dan Watson <http://danwatson.net/>
dave at thebarproject.com
David Ascher <http://ascher.ca/>
diff --git a/Django.egg-info/PKG-INFO b/Django.egg-info/PKG-INFO
index 9ae96a9..b02cca7 100644
--- a/Django.egg-info/PKG-INFO
+++ b/Django.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: Django
-Version: 1.9.6
+Version: 1.9.7
Summary: A high-level Python Web framework that encourages rapid development and clean, pragmatic design.
Home-page: http://www.djangoproject.com/
Author: Django Software Foundation
diff --git a/Django.egg-info/SOURCES.txt b/Django.egg-info/SOURCES.txt
index 50b71f4..b020203 100644
--- a/Django.egg-info/SOURCES.txt
+++ b/Django.egg-info/SOURCES.txt
@@ -3470,6 +3470,7 @@ docs/releases/1.9.3.txt
docs/releases/1.9.4.txt
docs/releases/1.9.5.txt
docs/releases/1.9.6.txt
+docs/releases/1.9.7.txt
docs/releases/1.9.txt
docs/releases/index.txt
docs/releases/security.txt
diff --git a/PKG-INFO b/PKG-INFO
index 9ae96a9..b02cca7 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: Django
-Version: 1.9.6
+Version: 1.9.7
Summary: A high-level Python Web framework that encourages rapid development and clean, pragmatic design.
Home-page: http://www.djangoproject.com/
Author: Django Software Foundation
diff --git a/django/__init__.py b/django/__init__.py
index fe7614e..cb6deaf 100644
--- a/django/__init__.py
+++ b/django/__init__.py
@@ -1,6 +1,6 @@
from django.utils.version import get_version
-VERSION = (1, 9, 6, 'final', 0)
+VERSION = (1, 9, 7, 'final', 0)
__version__ = get_version(VERSION)
diff --git a/django/contrib/admin/sites.py b/django/contrib/admin/sites.py
index 0e43b18..4b773be 100644
--- a/django/contrib/admin/sites.py
+++ b/django/contrib/admin/sites.py
@@ -398,6 +398,7 @@ class AdminSite(object):
context = dict(self.each_context(request),
title=_('Log in'),
app_path=request.get_full_path(),
+ username=request.user.get_username(),
)
if (REDIRECT_FIELD_NAME not in request.GET and
REDIRECT_FIELD_NAME not in request.POST):
diff --git a/django/contrib/admin/templates/admin/login.html b/django/contrib/admin/templates/admin/login.html
index adb58d6..4b4954a 100644
--- a/django/contrib/admin/templates/admin/login.html
+++ b/django/contrib/admin/templates/admin/login.html
@@ -34,7 +34,7 @@
{% if user.is_authenticated %}
<p class="errornote">
-{% blocktrans with username=request.user.get_username trimmed %}
+{% blocktrans trimmed %}
You are authenticated as {{ username }}, but are not authorized to
access this page. Would you like to login to a different account?
{% endblocktrans %}
diff --git a/django/contrib/auth/password_validation.py b/django/contrib/auth/password_validation.py
index 2af5202..aba2d6f 100644
--- a/django/contrib/auth/password_validation.py
+++ b/django/contrib/auth/password_validation.py
@@ -10,9 +10,10 @@ from django.core.exceptions import ImproperlyConfigured, ValidationError
from django.utils import lru_cache
from django.utils._os import upath
from django.utils.encoding import force_text
+from django.utils.functional import lazy
from django.utils.html import format_html
from django.utils.module_loading import import_string
-from django.utils.six import string_types
+from django.utils.six import string_types, text_type
from django.utils.translation import ugettext as _, ungettext
@@ -77,7 +78,7 @@ def password_validators_help_texts(password_validators=None):
return help_texts
-def password_validators_help_text_html(password_validators=None):
+def _password_validators_help_text_html(password_validators=None):
"""
Return an HTML string with all help texts of all configured validators
in an <ul>.
@@ -85,6 +86,7 @@ def password_validators_help_text_html(password_validators=None):
help_texts = password_validators_help_texts(password_validators)
help_items = [format_html('<li>{}</li>', help_text) for help_text in help_texts]
return '<ul>%s</ul>' % ''.join(help_items) if help_items else ''
+password_validators_help_text_html = lazy(_password_validators_help_text_html, text_type)
class MinimumLengthValidator(object):
diff --git a/django/contrib/gis/templates/gis/openlayers.html b/django/contrib/gis/templates/gis/openlayers.html
index 81f33ae..7a25a21 100644
--- a/django/contrib/gis/templates/gis/openlayers.html
+++ b/django/contrib/gis/templates/gis/openlayers.html
@@ -5,11 +5,11 @@
#{{ id }}_div_map { position: relative; vertical-align: top; float: {{ LANGUAGE_BIDI|yesno:"right,left" }}; }
{% if not display_raw %}#{{ id }} { display: none; }{% endif %}
.olControlEditingToolbar .olControlModifyFeatureItemActive {
- background-image: url("{% static "admin/img/gis/move_vertex_on.svg" %});
+ background-image: url("{% static "admin/img/gis/move_vertex_on.svg" %}");
background-repeat: no-repeat;
}
.olControlEditingToolbar .olControlModifyFeatureItemInactive {
- background-image: url("{% static "admin/img/gis/move_vertex_off.svg" %});
+ background-image: url("{% static "admin/img/gis/move_vertex_off.svg" %}");
background-repeat: no-repeat;
}{% endblock %}
</style>
diff --git a/django/contrib/postgres/forms/hstore.py b/django/contrib/postgres/forms/hstore.py
index bf562c0..4ed99d1 100644
--- a/django/contrib/postgres/forms/hstore.py
+++ b/django/contrib/postgres/forms/hstore.py
@@ -9,10 +9,13 @@ __all__ = ['HStoreField']
class HStoreField(forms.CharField):
- """A field for HStore data which accepts JSON input."""
+ """
+ A field for HStore data which accepts dictionary JSON input.
+ """
widget = forms.Textarea
default_error_messages = {
'invalid_json': _('Could not load JSON data.'),
+ 'invalid_format': _('Input must be a JSON dictionary.'),
}
def prepare_value(self, value):
@@ -31,6 +34,13 @@ class HStoreField(forms.CharField):
self.error_messages['invalid_json'],
code='invalid_json',
)
+
+ if not isinstance(value, dict):
+ raise ValidationError(
+ self.error_messages['invalid_format'],
+ code='invalid_format',
+ )
+
# Cast everything to strings for ease.
for key, val in value.items():
value[key] = six.text_type(val)
diff --git a/django/db/backends/base/base.py b/django/db/backends/base/base.py
index 0356ab5..021fe0b 100644
--- a/django/db/backends/base/base.py
+++ b/django/db/backends/base/base.py
@@ -617,12 +617,11 @@ class BaseDatabaseWrapper(object):
def run_and_clear_commit_hooks(self):
self.validate_no_atomic_block()
- try:
- while self.run_on_commit:
- sids, func = self.run_on_commit.pop(0)
- func()
- finally:
- self.run_on_commit = []
+ current_run_on_commit = self.run_on_commit
+ self.run_on_commit = []
+ while current_run_on_commit:
+ sids, func = current_run_on_commit.pop(0)
+ func()
def copy(self, alias=None, allow_thread_sharing=None):
"""
diff --git a/django/db/backends/base/operations.py b/django/db/backends/base/operations.py
index 5d3cddf..643c922 100644
--- a/django/db/backends/base/operations.py
+++ b/django/db/backends/base/operations.py
@@ -262,7 +262,7 @@ class BaseDatabaseOperations(object):
def prepare_sql_script(self, sql):
"""
- Takes a SQL script that may contain multiple lines and returns a list
+ Takes an SQL script that may contain multiple lines and returns a list
of statements to feed to successive cursor.execute() calls.
Since few databases are able to process raw SQL scripts in a single
@@ -374,7 +374,7 @@ class BaseDatabaseOperations(object):
to tables with foreign keys pointing the tables being truncated.
PostgreSQL requires a cascade even if these tables are empty.
"""
- raise NotImplementedError('subclasses of BaseDatabaseOperations must provide a sql_flush() method')
+ raise NotImplementedError('subclasses of BaseDatabaseOperations must provide an sql_flush() method')
def sequence_reset_by_name_sql(self, style, sequences):
"""
diff --git a/django/db/backends/postgresql/client.py b/django/db/backends/postgresql/client.py
index 5e3e288..1b4b884 100644
--- a/django/db/backends/postgresql/client.py
+++ b/django/db/backends/postgresql/client.py
@@ -17,14 +17,14 @@ class DatabaseClient(BaseDatabaseClient):
executable_name = 'psql'
@classmethod
- def runshell_db(cls, settings_dict):
+ def runshell_db(cls, conn_params):
args = [cls.executable_name]
- host = settings_dict.get('HOST', '')
- port = settings_dict.get('PORT', '')
- name = settings_dict.get('NAME', '')
- user = settings_dict.get('USER', '')
- passwd = settings_dict.get('PASSWORD', '')
+ host = conn_params.get('host', '')
+ port = conn_params.get('port', '')
+ dbname = conn_params.get('database', '')
+ user = conn_params.get('user', '')
+ passwd = conn_params.get('password', '')
if user:
args += ['-U', user]
@@ -32,7 +32,7 @@ class DatabaseClient(BaseDatabaseClient):
args += ['-h', host]
if port:
args += ['-p', str(port)]
- args += [name]
+ args += [dbname]
temp_pgpass = None
try:
@@ -43,7 +43,7 @@ class DatabaseClient(BaseDatabaseClient):
print_(
_escape_pgpass(host) or '*',
str(port) or '*',
- _escape_pgpass(name) or '*',
+ _escape_pgpass(dbname) or '*',
_escape_pgpass(user) or '*',
_escape_pgpass(passwd),
file=temp_pgpass,
@@ -63,4 +63,4 @@ class DatabaseClient(BaseDatabaseClient):
del os.environ['PGPASSFILE']
def runshell(self):
- DatabaseClient.runshell_db(self.connection.settings_dict)
+ DatabaseClient.runshell_db(self.connection.get_connection_params())
diff --git a/django/db/models/expressions.py b/django/db/models/expressions.py
index b558668..f266375 100644
--- a/django/db/models/expressions.py
+++ b/django/db/models/expressions.py
@@ -477,7 +477,7 @@ class F(Combinable):
class Func(Expression):
"""
- A SQL function call.
+ An SQL function call.
"""
function = None
template = '%(function)s(%(expressions)s)'
diff --git a/django/db/models/fields/related_descriptors.py b/django/db/models/fields/related_descriptors.py
index abfa728..5bfac8f 100644
--- a/django/db/models/fields/related_descriptors.py
+++ b/django/db/models/fields/related_descriptors.py
@@ -243,7 +243,7 @@ class ForwardManyToOneDescriptor(object):
for lh_field, rh_field in self.field.related_fields:
setattr(instance, lh_field.attname, getattr(value, rh_field.attname))
- # Set the related instance cache used by __get__ to avoid a SQL query
+ # Set the related instance cache used by __get__ to avoid an SQL query
# when accessing the attribute we just set.
setattr(instance, self.cache_name, value)
@@ -416,7 +416,7 @@ class ReverseOneToOneDescriptor(object):
for index, field in enumerate(self.related.field.local_related_fields):
setattr(value, field.attname, related_pk[index])
- # Set the related instance cache used by __get__ to avoid a SQL query
+ # Set the related instance cache used by __get__ to avoid an SQL query
# when accessing the attribute we just set.
setattr(instance, self.cache_name, value)
diff --git a/django/db/models/fields/related_lookups.py b/django/db/models/fields/related_lookups.py
index 0f5a8b5..27d649f 100644
--- a/django/db/models/fields/related_lookups.py
+++ b/django/db/models/fields/related_lookups.py
@@ -24,15 +24,16 @@ def get_normalized_value(value, lhs):
from django.db.models import Model
if isinstance(value, Model):
value_list = []
- # A case like Restaurant.objects.filter(place=restaurant_instance),
- # where place is a OneToOneField and the primary key of Restaurant.
- if getattr(lhs.output_field, 'primary_key', False):
- return (value.pk,)
sources = lhs.output_field.get_path_info()[-1].target_fields
for source in sources:
while not isinstance(value, source.model) and source.remote_field:
source = source.remote_field.model._meta.get_field(source.remote_field.field_name)
- value_list.append(getattr(value, source.attname))
+ try:
+ value_list.append(getattr(value, source.attname))
+ except AttributeError:
+ # A case like Restaurant.objects.filter(place=restaurant_instance),
+ # where place is a OneToOneField and the primary key of Restaurant.
+ return (value.pk,)
return tuple(value_list)
if not isinstance(value, tuple):
return (value,)
diff --git a/django/http/utils.py b/django/http/utils.py
index 3ea71cb..b3074f6 100644
--- a/django/http/utils.py
+++ b/django/http/utils.py
@@ -12,7 +12,7 @@ Functions that modify an HTTP request or response in some way.
def conditional_content_removal(request, response):
"""
Removes the content of responses for HEAD requests, 1xx, 204 and 304
- responses. Ensures compliance with RFC 2616, section 4.3.
+ responses. Ensures compliance with RFC 7230, section 3.3.3.
"""
if 100 <= response.status_code < 200 or response.status_code in (204, 304):
if response.streaming:
diff --git a/django/middleware/csrf.py b/django/middleware/csrf.py
index 25fb733..3134c6f 100644
--- a/django/middleware/csrf.py
+++ b/django/middleware/csrf.py
@@ -123,7 +123,7 @@ class CsrfViewMiddleware(object):
if getattr(callback, 'csrf_exempt', False):
return None
- # Assume that anything not defined as 'safe' by RFC2616 needs protection
+ # Assume that anything not defined as 'safe' by RFC7231 needs protection
if request.method not in ('GET', 'HEAD', 'OPTIONS', 'TRACE'):
if getattr(request, '_dont_enforce_csrf_checks', False):
# Mechanism to turn off CSRF checks for test suite.
diff --git a/django/template/defaultfilters.py b/django/template/defaultfilters.py
index eba65e5..dc7ba32 100644
--- a/django/template/defaultfilters.py
+++ b/django/template/defaultfilters.py
@@ -246,8 +246,8 @@ def stringformat(value, arg):
This specifier uses Python string formating syntax, with the exception that
the leading "%" is dropped.
- See http://docs.python.org/lib/typesseq-strings.html for documentation
- of Python string formatting
+ See https://docs.python.org/3/library/stdtypes.html#printf-style-string-formatting
+ for documentation of Python string formatting.
"""
try:
return ("%" + six.text_type(arg)) % value
diff --git a/django/template/loaders/cached.py b/django/template/loaders/cached.py
index 1a3851d..104a335 100644
--- a/django/template/loaders/cached.py
+++ b/django/template/loaders/cached.py
@@ -9,7 +9,7 @@ import warnings
from django.template import Origin, Template, TemplateDoesNotExist
from django.template.backends.django import copy_exception
from django.utils.deprecation import RemovedInDjango20Warning
-from django.utils.encoding import force_bytes
+from django.utils.encoding import force_bytes, force_text
from django.utils.inspect import func_supports_parameter
from .base import Loader as BaseLoader
@@ -100,7 +100,7 @@ class Loader(BaseLoader):
if template_dirs:
dirs_prefix = self.generate_hash(template_dirs)
- return '-'.join(filter(bool, [template_name, skip_prefix, dirs_prefix]))
+ return '-'.join(filter(bool, [force_text(template_name), skip_prefix, dirs_prefix]))
def generate_hash(self, values):
return hashlib.sha1(force_bytes('|'.join(values))).hexdigest()
diff --git a/django/utils/cache.py b/django/utils/cache.py
index c8ab96f..24f9825 100644
--- a/django/utils/cache.py
+++ b/django/utils/cache.py
@@ -6,7 +6,7 @@ that header-patching themselves.
For information on the Vary header, see:
- http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.44
+ https://tools.ietf.org/html/rfc7231#section-7.1.4
Essentially, the "Vary" HTTP header defines which headers a cache should take
into account when building its cache key. Requests with the same path but
diff --git a/django/utils/http.py b/django/utils/http.py
index 62e854d..c053185 100644
--- a/django/utils/http.py
+++ b/django/utils/http.py
@@ -114,7 +114,7 @@ def cookie_date(epoch_seconds=None):
def http_date(epoch_seconds=None):
"""
Formats the time to match the RFC1123 date format as specified by HTTP
- RFC2616 section 3.3.1.
+ RFC7231 section 7.1.1.1.
Accepts a floating point number expressed in seconds since the epoch, in
UTC - such as that outputted by time.time(). If set to None, defaults to
@@ -127,7 +127,7 @@ def http_date(epoch_seconds=None):
def parse_http_date(date):
"""
- Parses a date format as specified by HTTP RFC2616 section 3.3.1.
+ Parses a date format as specified by HTTP RFC7231 section 7.1.1.1.
The three formats allowed by the RFC are accepted, even if only the first
one is still in widespread use.
@@ -135,7 +135,7 @@ def parse_http_date(date):
Returns an integer expressed in seconds since the epoch, in UTC.
"""
# emails.Util.parsedate does the job for RFC1123 dates; unfortunately
- # RFC2616 makes it mandatory to support RFC850 dates too. So we roll
+ # RFC7231 makes it mandatory to support RFC850 dates too. So we roll
# our own RFC-compliant parsing.
for regex in RFC1123_DATE, RFC850_DATE, ASCTIME_DATE:
m = regex.match(date)
diff --git a/django/views/defaults.py b/django/views/defaults.py
index d4651e6..5d69a5d 100644
--- a/django/views/defaults.py
+++ b/django/views/defaults.py
@@ -91,7 +91,7 @@ def permission_denied(request, exception, template_name='403.html'):
Context: None
If the template does not exist, an Http403 response containing the text
- "403 Forbidden" (as per RFC 2616) will be returned.
+ "403 Forbidden" (as per RFC 7231) will be returned.
"""
try:
template = loader.get_template(template_name)
diff --git a/docs/conf.py b/docs/conf.py
index 49f8d82..7d237f6 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -145,6 +145,9 @@ intersphinx_mapping = {
# Python's docs don't change every week.
intersphinx_cache_limit = 90 # days
+# The 'versionadded' and 'versionchanged' directives are overridden.
+suppress_warnings = ['app.add_directive']
+
# -- Options for HTML output ---------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
diff --git a/docs/howto/custom-lookups.txt b/docs/howto/custom-lookups.txt
index 87a3882..22b61fb 100644
--- a/docs/howto/custom-lookups.txt
+++ b/docs/howto/custom-lookups.txt
@@ -71,7 +71,7 @@ We then need to define the ``as_sql`` method. This takes a ``SQLCompiler``
object, called ``compiler``, and the active database connection.
``SQLCompiler`` objects are not documented, but the only thing we need to know
about them is that they have a ``compile()`` method which returns a tuple
-containing a SQL string, and the parameters to be interpolated into that
+containing an SQL string, and the parameters to be interpolated into that
string. In most cases, you don't need to use it directly and can pass it on to
``process_lhs()`` and ``process_rhs()``.
@@ -92,7 +92,7 @@ example, ``process_lhs`` returns ``('"author"."name"', [])`` and
parameters for the left hand side, but this would depend on the object we have,
so we still need to include them in the parameters we return.
-Finally we combine the parts into a SQL expression with ``<>``, and supply all
+Finally we combine the parts into an SQL expression with ``<>``, and supply all
the parameters for the query. We then return a tuple containing the generated
SQL string and the parameters.
@@ -296,7 +296,7 @@ would override ``get_lookup`` with something like::
dimension = int(lookup_name[1:])
except ValueError:
pass
- finally:
+ else:
return get_coordinate_lookup(dimension)
return super(CoordinatesField, self).get_lookup(lookup_name)
diff --git a/docs/howto/custom-management-commands.txt b/docs/howto/custom-management-commands.txt
index 7ebf775..6c4a004 100644
--- a/docs/howto/custom-management-commands.txt
+++ b/docs/howto/custom-management-commands.txt
@@ -116,11 +116,13 @@ options can be added in the :meth:`~BaseCommand.add_arguments` method like this:
parser.add_argument('poll_id', nargs='+', type=int)
# Named (optional) arguments
- parser.add_argument('--delete',
+ parser.add_argument(
+ '--delete',
action='store_true',
dest='delete',
default=False,
- help='Delete poll instead of closing it')
+ help='Delete poll instead of closing it',
+ )
def handle(self, *args, **options):
# ...
diff --git a/docs/howto/deployment/checklist.txt b/docs/howto/deployment/checklist.txt
index fe3692b..156617c 100644
--- a/docs/howto/deployment/checklist.txt
+++ b/docs/howto/deployment/checklist.txt
@@ -264,4 +264,4 @@ drastically increase CPU usage by causing worst-case performance when
creating ``dict`` instances. See `oCERT advisory #2011-003
<http://www.ocert.org/advisories/ocert-2011-003.html>`_ for more information.
-.. _-r: https://docs.python.org/using/cmdline.html#cmdoption-R
+.. _-r: https://docs.python.org/2/using/cmdline.html#cmdoption-R
diff --git a/docs/howto/error-reporting.txt b/docs/howto/error-reporting.txt
index 9ae194d..8ce5aae 100644
--- a/docs/howto/error-reporting.txt
+++ b/docs/howto/error-reporting.txt
@@ -207,10 +207,12 @@ filtered out of error reports in a production environment (that is, where
@sensitive_post_parameters('pass_word', 'credit_card_number')
def record_user_profile(request):
- UserProfile.create(user=request.user,
- password=request.POST['pass_word'],
- credit_card=request.POST['credit_card_number'],
- name=request.POST['name'])
+ UserProfile.create(
+ user=request.user,
+ password=request.POST['pass_word'],
+ credit_card=request.POST['credit_card_number'],
+ name=request.POST['name'],
+ )
...
In the above example, the values for the ``pass_word`` and
diff --git a/docs/howto/outputting-csv.txt b/docs/howto/outputting-csv.txt
index 2d9fded..26a0c4e 100644
--- a/docs/howto/outputting-csv.txt
+++ b/docs/howto/outputting-csv.txt
@@ -70,7 +70,7 @@ mention:
For more information, see the Python documentation of the :mod:`csv` module.
- .. _`csv module's examples section`: https://docs.python.org/library/csv.html#examples
+ .. _`csv module's examples section`: https://docs.python.org/2/library/csv.html#examples
.. _`python-unicodecsv module`: https://github.com/jdunck/python-unicodecsv
.. _streaming-csv-files:
diff --git a/docs/howto/static-files/deployment.txt b/docs/howto/static-files/deployment.txt
index da04273..805e799 100644
--- a/docs/howto/static-files/deployment.txt
+++ b/docs/howto/static-files/deployment.txt
@@ -104,9 +104,9 @@ Here's how this might look in a fabfile::
def deploy_static():
local('./manage.py collectstatic')
project.rsync_project(
- remote_dir = env.remote_static_root,
- local_dir = env.local_static_root,
- delete = True
+ remote_dir=env.remote_static_root,
+ local_dir=env.local_static_root,
+ delete=True,
)
.. _staticfiles-from-cdn:
diff --git a/docs/internals/contributing/committing-code.txt b/docs/internals/contributing/committing-code.txt
index 211bdf0..7ed5aa3 100644
--- a/docs/internals/contributing/committing-code.txt
+++ b/docs/internals/contributing/committing-code.txt
@@ -243,4 +243,4 @@ When a mistaken commit is discovered, please follow these guidelines:
For instance, if you did: ``git push upstream feature_antigravity``,
just do a reverse push: ``git push upstream :feature_antigravity``.
-.. _ticket tracker: https://code.djangoproject.com/newticket
+.. _ticket tracker: https://code.djangoproject.com/
diff --git a/docs/internals/contributing/index.txt b/docs/internals/contributing/index.txt
index d46fafe..2614df9 100644
--- a/docs/internals/contributing/index.txt
+++ b/docs/internals/contributing/index.txt
@@ -65,5 +65,5 @@ Browse the following sections to find out how:
.. _#django IRC channel: irc://irc.freenode.net/django
.. _community page: https://www.djangoproject.com/community/
.. _register it here: https://www.djangoproject.com/community/add/blogs/
-.. _ticket tracker: https://code.djangoproject.com/newticket
+.. _ticket tracker: https://code.djangoproject.com/
.. _easy pickings: https://code.djangoproject.com/query?status=!closed&easy=1
diff --git a/docs/internals/contributing/writing-code/submitting-patches.txt b/docs/internals/contributing/writing-code/submitting-patches.txt
index 471c281..fad37e0 100644
--- a/docs/internals/contributing/writing-code/submitting-patches.txt
+++ b/docs/internals/contributing/writing-code/submitting-patches.txt
@@ -139,7 +139,7 @@ Regardless of the way you submit your work, follow these steps.
checked. This makes the ticket appear in the "Patches needing review" queue
on the `Development dashboard`_.
-.. _ticket tracker: https://code.djangoproject.com/newticket
+.. _ticket tracker: https://code.djangoproject.com/
.. _Development dashboard: https://dashboard.djangoproject.com/
Non-trivial patches
diff --git a/docs/internals/contributing/writing-documentation.txt b/docs/internals/contributing/writing-documentation.txt
index 8cb5039..12aebe2 100644
--- a/docs/internals/contributing/writing-documentation.txt
+++ b/docs/internals/contributing/writing-documentation.txt
@@ -48,15 +48,6 @@ __ http://docutils.sourceforge.net/
To actually build the documentation locally, you'll currently need to install
Sphinx -- ``pip install Sphinx`` should do the trick.
-.. note::
-
- Building the Django documentation requires Sphinx 1.0.2 or newer. Sphinx
- also requires the Pygments__ library for syntax highlighting; building the
- Django documentation requires Pygments 1.1 or newer (a new-enough version
- should automatically be installed along with Sphinx).
-
-__ http://pygments.org
-
Then, building the HTML is easy; just ``make html`` (or ``make.bat html`` on
Windows) from the ``docs`` directory.
diff --git a/docs/intro/contributing.txt b/docs/intro/contributing.txt
index ab18389..ac06c1c 100644
--- a/docs/intro/contributing.txt
+++ b/docs/intro/contributing.txt
@@ -370,10 +370,9 @@ that passing a ``prefix`` parameter when creating an instance still works too.
* Dive Into Python (a free online book for beginning Python developers)
includes a great `introduction to Unit Testing`__.
* After reading those, if you want something a little meatier to sink
- your teeth into, there's always the `Python unittest documentation`__.
+ your teeth into, there's always the Python :mod:`unittest` documentation.
__ http://www.diveintopython.net/unit_testing/index.html
-__ https://docs.python.org/library/unittest.html
Running your new test
---------------------
diff --git a/docs/intro/overview.txt b/docs/intro/overview.txt
index 8b5846f..2324ef8 100644
--- a/docs/intro/overview.txt
+++ b/docs/intro/overview.txt
@@ -201,15 +201,13 @@ example above:
url(r'^articles/([0-9]{4})/([0-9]{2})/([0-9]+)/$', views.article_detail),
]
-The code above maps URLs, as simple `regular expressions`_, to the location of
-Python callback functions ("views"). The regular expressions use parenthesis to
-"capture" values from the URLs. When a user requests a page, Django runs
-through each pattern, in order, and stops at the first one that matches the
-requested URL. (If none of them matches, Django calls a special-case 404 view.)
-This is blazingly fast, because the regular expressions are compiled at load
-time.
-
-.. _regular expressions: https://docs.python.org/howto/regex.html
+The code above maps URLs, as simple :ref:`regular expressions <regex-howto>`,
+to the location of Python callback functions ("views"). The regular expressions
+use parenthesis to "capture" values from the URLs. When a user requests a page,
+Django runs through each pattern, in order, and stops at the first one that
+matches the requested URL. (If none of them matches, Django calls a
+special-case 404 view.) This is blazingly fast, because the regular expressions
+are compiled at load time.
Once one of the regexes matches, Django imports and calls the given view, which
is a simple Python function. Each view gets passed a request object --
diff --git a/docs/intro/reusable-apps.txt b/docs/intro/reusable-apps.txt
index fee59a3..c0e5e08 100644
--- a/docs/intro/reusable-apps.txt
+++ b/docs/intro/reusable-apps.txt
@@ -34,9 +34,9 @@ projects and ready to publish for others to install and use.
.. admonition:: Package? App?
- A Python `package <https://docs.python.org/tutorial/modules.html#packages>`_
- provides a way of grouping related Python code for easy reuse. A package
- contains one or more files of Python code (also known as "modules").
+ A Python :term:`package` provides a way of grouping related Python code for
+ easy reuse. A package contains one or more files of Python code (also known
+ as "modules").
A package can be imported with ``import foo.bar`` or ``from foo import
bar``. For a directory (like ``polls``) to form a package, it must contain
diff --git a/docs/intro/tutorial01.txt b/docs/intro/tutorial01.txt
index de86571..ba50451 100644
--- a/docs/intro/tutorial01.txt
+++ b/docs/intro/tutorial01.txt
@@ -102,8 +102,8 @@ These files are:
anything inside it (e.g. ``mysite.urls``).
* :file:`mysite/__init__.py`: An empty file that tells Python that this
- directory should be considered a Python package. (Read `more about
- packages`_ in the official Python docs if you're a Python beginner.)
+ directory should be considered a Python package. If you're a Python beginner,
+ read :ref:`more about packages <tut-packages>` in the official Python docs.
* :file:`mysite/settings.py`: Settings/configuration for this Django
project. :doc:`/topics/settings` will tell you all about how settings
@@ -116,8 +116,6 @@ These files are:
* :file:`mysite/wsgi.py`: An entry-point for WSGI-compatible web servers to
serve your project. See :doc:`/howto/deployment/wsgi/index` for more details.
-.. _more about packages: https://docs.python.org/tutorial/modules.html#packages
-
The development server
======================
@@ -211,9 +209,10 @@ rather than creating directories.
configuration and apps for a particular website. A project can contain
multiple apps. An app can be in multiple projects.
-Your apps can live anywhere on your `Python path`_. In this tutorial, we'll
-create our poll app right next to your :file:`manage.py` file so that it can be
-imported as its own top-level module, rather than a submodule of ``mysite``.
+Your apps can live anywhere on your :ref:`Python path <tut-searchpath>`. In
+this tutorial, we'll create our poll app right next to your :file:`manage.py`
+file so that it can be imported as its own top-level module, rather than a
+submodule of ``mysite``.
To create your app, make sure you're in the same directory as :file:`manage.py`
and type this command:
@@ -236,8 +235,6 @@ That'll create a directory :file:`polls`, which is laid out like this::
This directory structure will house the poll application.
-.. _`Python path`: https://docs.python.org/tutorial/modules.html#the-module-search-path
-
Write your first view
=====================
diff --git a/docs/intro/tutorial05.txt b/docs/intro/tutorial05.txt
index 3bda060..2925d6d 100644
--- a/docs/intro/tutorial05.txt
+++ b/docs/intro/tutorial05.txt
@@ -462,8 +462,7 @@ class:
in the past, positive for questions that have yet to be published).
"""
time = timezone.now() + datetime.timedelta(days=days)
- return Question.objects.create(question_text=question_text,
- pub_date=time)
+ return Question.objects.create(question_text=question_text, pub_date=time)
class QuestionViewTests(TestCase):
@@ -495,8 +494,7 @@ class:
"""
create_question(question_text="Future question.", days=30)
response = self.client.get(reverse('polls:index'))
- self.assertContains(response, "No polls are available.",
- status_code=200)
+ self.assertContains(response, "No polls are available.")
self.assertQuerysetEqual(response.context['latest_question_list'], [])
def test_index_view_with_future_question_and_past_question(self):
@@ -580,10 +578,9 @@ in the future is not:
The detail view of a question with a pub_date in the future should
return a 404 not found.
"""
- future_question = create_question(question_text='Future question.',
- days=5)
- response = self.client.get(reverse('polls:detail',
- args=(future_question.id,)))
+ future_question = create_question(question_text='Future question.', days=5)
+ url = reverse('polls:detail', args=(future_question.id,))
+ response = self.client.get(url)
self.assertEqual(response.status_code, 404)
def test_detail_view_with_a_past_question(self):
@@ -591,13 +588,10 @@ in the future is not:
The detail view of a question with a pub_date in the past should
display the question's text.
"""
- past_question = create_question(question_text='Past Question.',
- days=-5)
- response = self.client.get(reverse('polls:detail',
- args=(past_question.id,)))
- self.assertContains(response, past_question.question_text,
- status_code=200)
-
+ past_question = create_question(question_text='Past Question.', days=-5)
+ url = reverse('polls:detail', args=(past_question.id,))
+ response = self.client.get(url)
+ self.assertContains(response, past_question.question_text)
Ideas for more tests
--------------------
diff --git a/docs/intro/whatsnext.txt b/docs/intro/whatsnext.txt
index 8554905..36a5681 100644
--- a/docs/intro/whatsnext.txt
+++ b/docs/intro/whatsnext.txt
@@ -128,7 +128,7 @@ rather than asking broad tech-support questions. If you need help with your
particular Django setup, try the |django-users| mailing list or the `#django
IRC channel`_ instead.
-.. _ticket system: https://code.djangoproject.com/newticket?component=Documentation
+.. _ticket system: https://code.djangoproject.com/
.. _#django IRC channel: irc://irc.freenode.net/django
In plain text
diff --git a/docs/ref/class-based-views/base.txt b/docs/ref/class-based-views/base.txt
index 542d863..00af153 100644
--- a/docs/ref/class-based-views/base.txt
+++ b/docs/ref/class-based-views/base.txt
@@ -94,8 +94,10 @@ MRO is an acronym for Method Resolution Order.
.. method:: options(request, *args, **kwargs)
- Handles responding to requests for the OPTIONS HTTP verb. Returns a
- list of the allowed HTTP method names for the view.
+ Handles responding to requests for the OPTIONS HTTP verb. Returns a
+ response with the ``Allow`` header containing a list of the view's
+ allowed HTTP method names.
+
``TemplateView``
================
diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt
index 10260cc..637dc01 100644
--- a/docs/ref/contrib/admin/index.txt
+++ b/docs/ref/contrib/admin/index.txt
@@ -617,10 +617,12 @@ subclass::
color_code = models.CharField(max_length=6)
def colored_name(self):
- return format_html('<span style="color: #{};">{} {}</span>',
- self.color_code,
- self.first_name,
- self.last_name)
+ return format_html(
+ '<span style="color: #{};">{} {}</span>',
+ self.color_code,
+ self.first_name,
+ self.last_name,
+ )
class PersonAdmin(admin.ModelAdmin):
list_display = ('first_name', 'last_name', 'colored_name')
@@ -706,9 +708,11 @@ subclass::
color_code = models.CharField(max_length=6)
def colored_first_name(self):
- return format_html('<span style="color: #{};">{}</span>',
- self.color_code,
- self.first_name)
+ return format_html(
+ '<span style="color: #{};">{}</span>',
+ self.color_code,
+ self.first_name,
+ )
colored_first_name.admin_order_field = 'first_name'
@@ -912,13 +916,11 @@ subclass::
def lookups(self, request, model_admin):
if request.user.is_superuser:
- return super(AuthDecadeBornListFilter,
- self).lookups(request, model_admin)
+ return super(AuthDecadeBornListFilter, self).lookups(request, model_admin)
def queryset(self, request, queryset):
if request.user.is_superuser:
- return super(AuthDecadeBornListFilter,
- self).queryset(request, queryset)
+ return super(AuthDecadeBornListFilter, self).queryset(request, queryset)
Also as a convenience, the ``ModelAdmin`` object is passed to
the ``lookups`` method, for example if you want to base the
@@ -1268,8 +1270,8 @@ subclass::
class PersonAdmin(admin.ModelAdmin):
def view_on_site(self, obj):
- return 'https://example.com' + reverse('person-detail',
- kwargs={'slug': obj.slug})
... 2779 lines suppressed ...
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-django.git
More information about the Python-modules-commits
mailing list