[Python-modules-commits] [python-django] 01/10: Import python-django_1.8.8.orig.tar.gz
Raphaël Hertzog
hertzog at moszumanska.debian.org
Tue Jan 5 13:37:23 UTC 2016
This is an automated email from the git hooks/post-receive script.
hertzog pushed a commit to branch debian/jessie-backports
in repository python-django.
commit 8e72530305ba6d4e66ffddfc14a0103e03c6458d
Author: Raphaël Hertzog <hertzog at debian.org>
Date: Tue Jan 5 10:43:03 2016 +0100
Import python-django_1.8.8.orig.tar.gz
---
AUTHORS | 1 +
Django.egg-info/PKG-INFO | 3 +-
Django.egg-info/SOURCES.txt | 5 +
PKG-INFO | 3 +-
django/__init__.py | 2 +-
django/conf/project_template/project_name/urls.py | 3 +-
django/contrib/admin/helpers.py | 1 +
.../contrib/gis/management/commands/inspectdb.py | 4 +-
django/contrib/postgres/fields/array.py | 6 +-
django/core/cache/backends/base.py | 2 +-
django/core/management/commands/inspectdb.py | 8 +-
django/core/management/commands/loaddata.py | 10 +
django/db/backends/postgresql_psycopg2/schema.py | 62 ++++--
django/db/migrations/operations/models.py | 1 +
django/db/migrations/operations/special.py | 2 +-
django/db/models/expressions.py | 3 +-
django/db/models/fields/files.py | 2 +-
django/db/models/fields/subclassing.py | 2 +-
django/utils/cache.py | 1 +
django/utils/formats.py | 8 +-
django/utils/translation/trans_real.py | 33 ++--
docs/faq/install.txt | 2 +-
docs/howto/custom-lookups.txt | 8 +-
docs/howto/static-files/deployment.txt | 2 +-
docs/intro/tutorial03.txt | 14 +-
docs/man/django-admin.1 | 2 +-
docs/ref/contrib/gis/geos.txt | 12 +-
docs/ref/contrib/postgres/fields.txt | 4 +-
docs/ref/django-admin.txt | 4 +-
docs/ref/forms/validation.txt | 2 +-
docs/ref/models/fields.txt | 2 +-
docs/ref/models/relations.txt | 2 +-
docs/ref/templates/api.txt | 7 +-
docs/releases/1.7.txt | 4 +-
docs/releases/1.8.8.txt | 60 ++++++
docs/releases/1.8.txt | 18 ++
docs/releases/index.txt | 1 +
docs/releases/security.txt | 213 ++++++++++++++++-----
docs/topics/auth/customizing.txt | 10 +-
docs/topics/auth/default.txt | 2 +-
docs/topics/db/managers.txt | 4 +-
docs/topics/files.txt | 4 +-
docs/topics/http/shortcuts.txt | 9 +-
docs/topics/i18n/formatting.txt | 5 +-
setup.py | 1 +
tests/admin_views/admin.py | 4 +-
tests/admin_views/models.py | 2 +
tests/admin_views/tests.py | 25 ++-
tests/admin_widgets/tests.py | 2 +
tests/decorators/tests.py | 12 ++
tests/expressions_case/tests.py | 12 ++
tests/fixtures/tests.py | 14 +-
.../i18n/commands/locale/xxx/LC_MESSAGES/django.mo | Bin 0 -> 457 bytes
.../i18n/commands/locale/xxx/LC_MESSAGES/django.po | 21 ++
tests/i18n/other/locale/fr/__init__.py | 0
tests/i18n/other/locale/fr/formats.py | 2 +
tests/i18n/tests.py | 28 ++-
tests/inspectdb/models.py | 9 +-
tests/inspectdb/tests.py | 13 +-
tests/migrations/test_operations.py | 84 ++++++++
tests/postgres_tests/test_array.py | 7 +
tests/schema/tests.py | 68 +++++++
tests/urlpatterns_reverse/tests.py | 2 +-
63 files changed, 703 insertions(+), 156 deletions(-)
diff --git a/AUTHORS b/AUTHORS
index 63855d7..06d9882 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -715,6 +715,7 @@ answer newbie questions, and generally made Django that much better:
Wilson Miner <wminer at gmail.com>
wojtek
Xia Kai <http://blog.xiaket.org/>
+ Yann Fouillat <gagaro42 at gmail.com>
Yann Malet
Yasushi Masuda <whosaysni at gmail.com>
ye7cakf02 at sneakemail.com
diff --git a/Django.egg-info/PKG-INFO b/Django.egg-info/PKG-INFO
index 510abdd..a62d086 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.8.7
+Version: 1.8.8
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
@@ -21,6 +21,7 @@ Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI
diff --git a/Django.egg-info/SOURCES.txt b/Django.egg-info/SOURCES.txt
index be483e1..52865cb 100644
--- a/Django.egg-info/SOURCES.txt
+++ b/Django.egg-info/SOURCES.txt
@@ -3408,6 +3408,7 @@ docs/releases/1.8.4.txt
docs/releases/1.8.5.txt
docs/releases/1.8.6.txt
docs/releases/1.8.7.txt
+docs/releases/1.8.8.txt
docs/releases/1.8.txt
docs/releases/index.txt
docs/releases/security.txt
@@ -4141,6 +4142,8 @@ tests/i18n/commands/locale/it/LC_MESSAGES/django.po
tests/i18n/commands/locale/ja/LC_MESSAGES/django.po
tests/i18n/commands/locale/pt_BR/LC_MESSAGES/django.pristine
tests/i18n/commands/locale/ru/LC_MESSAGES/django.po
+tests/i18n/commands/locale/xxx/LC_MESSAGES/django.mo
+tests/i18n/commands/locale/xxx/LC_MESSAGES/django.po
tests/i18n/commands/media_root/media_ignored.html
tests/i18n/commands/someapp/static/javascript.js
tests/i18n/commands/static/javascript_ignored.js
@@ -4168,6 +4171,8 @@ tests/i18n/other/locale/de/__init__.py
tests/i18n/other/locale/de/formats.py
tests/i18n/other/locale/de/LC_MESSAGES/django.mo
tests/i18n/other/locale/de/LC_MESSAGES/django.po
+tests/i18n/other/locale/fr/__init__.py
+tests/i18n/other/locale/fr/formats.py
tests/i18n/other/locale/fr/LC_MESSAGES/django.mo
tests/i18n/other/locale/fr/LC_MESSAGES/django.po
tests/i18n/other2/__init__.py
diff --git a/PKG-INFO b/PKG-INFO
index 510abdd..a62d086 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: Django
-Version: 1.8.7
+Version: 1.8.8
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
@@ -21,6 +21,7 @@ Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI
diff --git a/django/__init__.py b/django/__init__.py
index 98f98e3..aa515b5 100644
--- a/django/__init__.py
+++ b/django/__init__.py
@@ -1,6 +1,6 @@
from django.utils.version import get_version
-VERSION = (1, 8, 7, 'final', 0)
+VERSION = (1, 8, 8, 'final', 0)
__version__ = get_version(VERSION)
diff --git a/django/conf/project_template/project_name/urls.py b/django/conf/project_template/project_name/urls.py
index 665085b..cbc982d 100644
--- a/django/conf/project_template/project_name/urls.py
+++ b/django/conf/project_template/project_name/urls.py
@@ -10,8 +10,7 @@ Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
Including another URLconf
- 1. Add an import: from blog import urls as blog_urls
- 2. Add a URL to urlpatterns: url(r'^blog/', include(blog_urls))
+ 1. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import include, url
from django.contrib import admin
diff --git a/django/contrib/admin/helpers.py b/django/contrib/admin/helpers.py
index e50939b..1b6a0ff 100644
--- a/django/contrib/admin/helpers.py
+++ b/django/contrib/admin/helpers.py
@@ -207,6 +207,7 @@ class AdminReadonlyField(object):
result_repr = ", ".join(map(six.text_type, value.all()))
else:
result_repr = display_for_field(value, f)
+ result_repr = linebreaksbr(result_repr)
return conditional_escape(result_repr)
diff --git a/django/contrib/gis/management/commands/inspectdb.py b/django/contrib/gis/management/commands/inspectdb.py
index 229be74..03bfc47 100644
--- a/django/contrib/gis/management/commands/inspectdb.py
+++ b/django/contrib/gis/management/commands/inspectdb.py
@@ -22,8 +22,8 @@ class Command(InspectDBCommand):
self.gis_tables[table_name] = [geo_col]
return field_type, field_params, field_notes
- def get_meta(self, table_name, constraints):
- meta_lines = super(Command, self).get_meta(table_name, constraints)
+ def get_meta(self, table_name, constraints, column_to_field_name):
+ meta_lines = super(Command, self).get_meta(table_name, constraints, column_to_field_name)
if table_name in self.gis_tables:
# If the table is a geographic one, then we need make
# GeoManager the default manager for the model.
diff --git a/django/contrib/postgres/fields/array.py b/django/contrib/postgres/fields/array.py
index 8776061..ceac798 100644
--- a/django/contrib/postgres/fields/array.py
+++ b/django/contrib/postgres/fields/array.py
@@ -198,7 +198,11 @@ class ArrayLenTransform(Transform):
def as_sql(self, compiler, connection):
lhs, params = compiler.compile(self.lhs)
- return 'array_length(%s, 1)' % lhs, params
+ # Distinguish NULL and empty arrays
+ return (
+ 'CASE WHEN %(lhs)s IS NULL THEN NULL ELSE '
+ 'coalesce(array_length(%(lhs)s, 1), 0) END'
+ ) % {'lhs': lhs}, params
class IndexTransform(Transform):
diff --git a/django/core/cache/backends/base.py b/django/core/cache/backends/base.py
index 07e172e..25e5dca 100644
--- a/django/core/cache/backends/base.py
+++ b/django/core/cache/backends/base.py
@@ -195,7 +195,7 @@ class BaseCache(object):
def delete_many(self, keys, version=None):
"""
- Set a bunch of values in the cache at once. For certain backends
+ Delete a bunch of values in the cache at once. For certain backends
(memcached), this is much more efficient than calling delete() multiple
times.
"""
diff --git a/django/core/management/commands/inspectdb.py b/django/core/management/commands/inspectdb.py
index 60800df..085cf7c 100644
--- a/django/core/management/commands/inspectdb.py
+++ b/django/core/management/commands/inspectdb.py
@@ -73,6 +73,7 @@ class Command(BaseCommand):
except NotImplementedError:
constraints = {}
used_column_names = [] # Holds column names used in the table so far
+ column_to_field_name = {} # Maps column names to names of model fields
for row in connection.introspection.get_table_description(cursor, table_name):
comment_notes = [] # Holds Field notes, to be displayed in a Python comment.
extra_params = OrderedDict() # Holds Field parameters such as 'db_column'.
@@ -85,6 +86,7 @@ class Command(BaseCommand):
comment_notes.extend(notes)
used_column_names.append(att_name)
+ column_to_field_name[column_name] = att_name
# Add primary_key and unique, if necessary.
if column_name in indexes:
@@ -141,7 +143,7 @@ class Command(BaseCommand):
if comment_notes:
field_desc += ' # ' + ' '.join(comment_notes)
yield ' %s' % field_desc
- for meta_line in self.get_meta(table_name, constraints):
+ for meta_line in self.get_meta(table_name, constraints, column_to_field_name):
yield meta_line
def normalize_col_name(self, col_name, used_column_names, is_relation):
@@ -238,7 +240,7 @@ class Command(BaseCommand):
return field_type, field_params, field_notes
- def get_meta(self, table_name, constraints):
+ def get_meta(self, table_name, constraints, column_to_field_name):
"""
Return a sequence comprising the lines of code necessary
to construct the inner Meta class for the model corresponding
@@ -251,7 +253,7 @@ class Command(BaseCommand):
if len(columns) > 1:
# we do not want to include the u"" or u'' prefix
# so we build the string rather than interpolate the tuple
- tup = '(' + ', '.join("'%s'" % c for c in columns) + ')'
+ tup = '(' + ', '.join("'%s'" % column_to_field_name[c] for c in columns) + ')'
unique_together.append(tup)
meta = ["",
" class Meta:",
diff --git a/django/core/management/commands/loaddata.py b/django/core/management/commands/loaddata.py
index d65ccd4..879a03e 100644
--- a/django/core/management/commands/loaddata.py
+++ b/django/core/management/commands/loaddata.py
@@ -85,6 +85,16 @@ class Command(BaseCommand):
if has_bz2:
self.compression_formats['bz2'] = (bz2.BZ2File, 'r')
+ # Django's test suite repeatedly tries to load initial_data fixtures
+ # from apps that don't have any fixtures. Because disabling constraint
+ # checks can be expensive on some database (especially MSSQL), bail
+ # out early if no fixtures are found.
+ for fixture_label in fixture_labels:
+ if self.find_fixtures(fixture_label):
+ break
+ else:
+ return
+
with connection.constraint_checks_disabled():
for fixture_label in fixture_labels:
self.load_label(fixture_label)
diff --git a/django/db/backends/postgresql_psycopg2/schema.py b/django/db/backends/postgresql_psycopg2/schema.py
index 9446bfd..e425154 100644
--- a/django/db/backends/postgresql_psycopg2/schema.py
+++ b/django/db/backends/postgresql_psycopg2/schema.py
@@ -20,25 +20,33 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
return output
for field in model._meta.local_fields:
- db_type = field.db_type(connection=self.connection)
- if db_type is not None and (field.db_index or field.unique):
- # Fields with database column types of `varchar` and `text` need
- # a second index that specifies their operator class, which is
- # needed when performing correct LIKE queries outside the
- # C locale. See #12234.
- #
- # The same doesn't apply to array fields such as varchar[size]
- # and text[size], so skip them.
- if '[' in db_type:
- continue
- if db_type.startswith('varchar'):
- output.append(self._create_index_sql(
- model, [field], suffix='_like', sql=self.sql_create_varchar_index))
- elif db_type.startswith('text'):
- output.append(self._create_index_sql(
- model, [field], suffix='_like', sql=self.sql_create_text_index))
+ like_index_statement = self._create_like_index_sql(model, field)
+ if like_index_statement is not None:
+ output.append(like_index_statement)
return output
+ def _create_like_index_sql(self, model, field):
+ """
+ Return the statement to create an index with varchar operator pattern
+ when the column type is 'varchar' or 'text', otherwise return None.
+ """
+ db_type = field.db_type(connection=self.connection)
+ if db_type is not None and (field.db_index or field.unique):
+ # Fields with database column types of `varchar` and `text` need
+ # a second index that specifies their operator class, which is
+ # needed when performing correct LIKE queries outside the
+ # C locale. See #12234.
+ #
+ # The same doesn't apply to array fields such as varchar[size]
+ # and text[size], so skip them.
+ if '[' in db_type:
+ return None
+ if db_type.startswith('varchar'):
+ return self._create_index_sql(model, [field], suffix='_like', sql=self.sql_create_varchar_index)
+ elif db_type.startswith('text'):
+ return self._create_index_sql(model, [field], suffix='_like', sql=self.sql_create_text_index)
+ return None
+
def _alter_column_type_sql(self, table, old_field, new_field, new_type):
"""
Makes ALTER TYPE with SERIAL make sense.
@@ -91,3 +99,23 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
return super(DatabaseSchemaEditor, self)._alter_column_type_sql(
table, old_field, new_field, new_type
)
+
+ def _alter_field(self, model, old_field, new_field, old_type, new_type,
+ old_db_params, new_db_params, strict=False):
+ super(DatabaseSchemaEditor, self)._alter_field(
+ model, old_field, new_field, old_type, new_type, old_db_params,
+ new_db_params, strict,
+ )
+ # Added an index? Create any PostgreSQL-specific indexes.
+ if ((not old_field.db_index and new_field.db_index) or (not old_field.unique and new_field.unique)):
+ like_index_statement = self._create_like_index_sql(model, new_field)
+ if like_index_statement is not None:
+ self.execute(like_index_statement)
+
+ # Removed an index? Drop any PostgreSQL-specific indexes.
+ if ((not new_field.db_index and old_field.db_index) or (not new_field.unique and old_field.unique)):
+ index_to_remove = self._create_index_name(model, [old_field.column], suffix='_like')
+ index_names = self._constraint_names(model, [old_field.column], index=True)
+ for index_name in index_names:
+ if index_name == index_to_remove:
+ self.execute(self._delete_constraint_sql(self.sql_delete_index, model, index_name))
diff --git a/django/db/migrations/operations/models.py b/django/db/migrations/operations/models.py
index c0eb92a..fa4da99 100644
--- a/django/db/migrations/operations/models.py
+++ b/django/db/migrations/operations/models.py
@@ -563,6 +563,7 @@ class AlterModelManagers(Operation):
def state_forwards(self, app_label, state):
model_state = state.models[app_label, self.name_lower]
model_state.managers = list(self.managers)
+ state.reload_model(app_label, self.name_lower)
def database_forwards(self, app_label, schema_editor, from_state, to_state):
pass
diff --git a/django/db/migrations/operations/special.py b/django/db/migrations/operations/special.py
index e1ce9a0..6bbae60 100644
--- a/django/db/migrations/operations/special.py
+++ b/django/db/migrations/operations/special.py
@@ -50,7 +50,7 @@ class SeparateDatabaseAndState(Operation):
to_state = base_state.clone()
for dbop in self.database_operations[:-(pos + 1)]:
dbop.state_forwards(app_label, to_state)
- from_state = base_state.clone()
+ from_state = to_state.clone()
database_operation.state_forwards(app_label, from_state)
database_operation.database_backwards(app_label, schema_editor, from_state, to_state)
diff --git a/django/db/models/expressions.py b/django/db/models/expressions.py
index 5d6fab6..83121a9 100644
--- a/django/db/models/expressions.py
+++ b/django/db/models/expressions.py
@@ -729,7 +729,8 @@ class When(Expression):
def resolve_expression(self, query=None, allow_joins=True, reuse=None, summarize=False, for_save=False):
c = self.copy()
c.is_summary = summarize
- c.condition = c.condition.resolve_expression(query, allow_joins, reuse, summarize, False)
+ if hasattr(c.condition, 'resolve_expression'):
+ c.condition = c.condition.resolve_expression(query, allow_joins, reuse, summarize, False)
c.result = c.result.resolve_expression(query, allow_joins, reuse, summarize, for_save)
return c
diff --git a/django/db/models/fields/files.py b/django/db/models/fields/files.py
index d6c1eaf..bf44759 100644
--- a/django/db/models/fields/files.py
+++ b/django/db/models/fields/files.py
@@ -163,7 +163,7 @@ class FileDescriptor(object):
Assigns a file object on assignment so you can do::
- >>> with open('/tmp/hello.world', 'r') as f:
+ >>> with open('/path/to/hello.world', 'r') as f:
... instance.file = File(f)
"""
diff --git a/django/db/models/fields/subclassing.py b/django/db/models/fields/subclassing.py
index 84d13ce..b8d3d10 100644
--- a/django/db/models/fields/subclassing.py
+++ b/django/db/models/fields/subclassing.py
@@ -19,7 +19,7 @@ class SubfieldBase(type):
"""
def __new__(cls, name, bases, attrs):
warnings.warn("SubfieldBase has been deprecated. Use Field.from_db_value instead.",
- RemovedInDjango110Warning)
+ RemovedInDjango110Warning, stacklevel=2)
new_class = super(SubfieldBase, cls).__new__(cls, name, bases, attrs)
new_class.contribute_to_class = make_contrib(
diff --git a/django/utils/cache.py b/django/utils/cache.py
index e48e159..66d5e75 100644
--- a/django/utils/cache.py
+++ b/django/utils/cache.py
@@ -134,6 +134,7 @@ def add_never_cache_headers(response):
Adds headers to a response to indicate that a page should never be cached.
"""
patch_response_headers(response, cache_timeout=-1)
+ patch_cache_control(response, no_cache=True, no_store=True, must_revalidate=True)
def patch_vary_headers(response, newheaders):
diff --git a/django/utils/formats.py b/django/utils/formats.py
index 767871b..4faf101 100644
--- a/django/utils/formats.py
+++ b/django/utils/formats.py
@@ -113,8 +113,6 @@ def get_format(format_type, lang=None, use_l10n=None):
be localized (or not), overriding the value of settings.USE_L10N.
"""
format_type = force_str(format_type)
- if format_type not in FORMAT_SETTINGS:
- return format_type
if use_l10n or (use_l10n is None and settings.USE_L10N):
if lang is None:
lang = get_language()
@@ -123,9 +121,6 @@ def get_format(format_type, lang=None, use_l10n=None):
cached = _format_cache[cache_key]
if cached is not None:
return cached
- else:
- # Return the general setting by default
- return getattr(settings, format_type)
except KeyError:
for module in get_format_modules(lang):
try:
@@ -140,6 +135,9 @@ def get_format(format_type, lang=None, use_l10n=None):
except AttributeError:
pass
_format_cache[cache_key] = None
+ if format_type not in FORMAT_SETTINGS:
+ return format_type
+ # Return the general setting by default
return getattr(settings, format_type)
get_format_lazy = lazy(get_format, six.text_type, list, tuple)
diff --git a/django/utils/translation/trans_real.py b/django/utils/translation/trans_real.py
index 6e7ef9b..aa50c02 100644
--- a/django/utils/translation/trans_real.py
+++ b/django/utils/translation/trans_real.py
@@ -112,10 +112,14 @@ class DjangoTranslation(gettext_module.GNUTranslations):
self.__language = language
self.__to_language = to_language(language)
self.__locale = to_locale(language)
+ self._catalog = None
self._init_translation_catalog()
self._add_installed_apps_translations()
self._add_local_translations()
+ if self.__language == settings.LANGUAGE_CODE and self._catalog is None:
+ # default lang should have at least one translation file available.
+ raise IOError("No translation files found for default language %s." % settings.LANGUAGE_CODE)
self._add_fallback()
def __repr__(self):
@@ -129,32 +133,19 @@ class DjangoTranslation(gettext_module.GNUTranslations):
Using param `use_null_fallback` to avoid confusion with any other
references to 'fallback'.
"""
- translation = gettext_module.translation(
+ return gettext_module.translation(
domain='django',
localedir=localedir,
languages=[self.__locale],
codeset='utf-8',
fallback=use_null_fallback)
- if not hasattr(translation, '_catalog'):
- # provides merge support for NullTranslations()
- translation._catalog = {}
- translation._info = {}
- translation.plural = lambda n: int(n != 1)
- return translation
def _init_translation_catalog(self):
"""Creates a base catalog using global django translations."""
settingsfile = upath(sys.modules[settings.__module__].__file__)
localedir = os.path.join(os.path.dirname(settingsfile), 'locale')
- use_null_fallback = True
- if self.__language == settings.LANGUAGE_CODE:
- # default lang should be present and parseable, if not
- # gettext will raise an IOError (refs #18192).
- use_null_fallback = False
- translation = self._new_gnu_trans(localedir, use_null_fallback)
- self.plural = translation.plural
- self._info = translation._info.copy()
- self._catalog = translation._catalog.copy()
+ translation = self._new_gnu_trans(localedir)
+ self.merge(translation)
def _add_installed_apps_translations(self):
"""Merges translations from each installed app."""
@@ -187,7 +178,15 @@ class DjangoTranslation(gettext_module.GNUTranslations):
def merge(self, other):
"""Merge another translation into this catalog."""
- self._catalog.update(other._catalog)
+ if not getattr(other, '_catalog', None):
+ return # NullTranslations() has no _catalog
+ if self._catalog is None:
+ # Take plural and _info from first catalog found (generally Django's).
+ self.plural = other.plural
+ self._info = other._info.copy()
+ self._catalog = other._catalog.copy()
+ else:
+ self._catalog.update(other._catalog)
def language(self):
"""Returns the translation language."""
diff --git a/docs/faq/install.txt b/docs/faq/install.txt
index 84acb55..7a75f87 100644
--- a/docs/faq/install.txt
+++ b/docs/faq/install.txt
@@ -46,7 +46,7 @@ What Python version can I use with Django?
Django version Python versions
============== ===============
1.7 2.7 and 3.2, 3.3, 3.4
-**1.8** **2.7** and **3.2, 3.3, 3.4, 3.5**
+**1.8** **2.7** and **3.2 (until the end of 2016), 3.3, 3.4, 3.5**
1.9 2.7, 3.4, 3.5
============== ===============
diff --git a/docs/howto/custom-lookups.txt b/docs/howto/custom-lookups.txt
index 6b9545a..1878a65 100644
--- a/docs/howto/custom-lookups.txt
+++ b/docs/howto/custom-lookups.txt
@@ -202,10 +202,10 @@ The implementation is::
There are a couple of notable things going on. First, ``AbsoluteValueLessThan``
isn't calling ``process_lhs()``. Instead it skips the transformation of the
``lhs`` done by ``AbsoluteValue`` and uses the original ``lhs``. That is, we
-want to get ``27`` not ``ABS(27)``. Referring directly to ``self.lhs.lhs`` is
-safe as ``AbsoluteValueLessThan`` can be accessed only from the
-``AbsoluteValue`` lookup, that is the ``lhs`` is always an instance of
-``AbsoluteValue``.
+want to get ``"experiments"."change"`` not ``ABS("experiments"."change")``.
+Referring directly to ``self.lhs.lhs`` is safe as ``AbsoluteValueLessThan``
+can be accessed only from the ``AbsoluteValue`` lookup, that is the ``lhs``
+is always an instance of ``AbsoluteValue``.
Notice also that as both sides are used multiple times in the query the params
need to contain ``lhs_params`` and ``rhs_params`` multiple times.
diff --git a/docs/howto/static-files/deployment.txt b/docs/howto/static-files/deployment.txt
index a88403f..c539752 100644
--- a/docs/howto/static-files/deployment.txt
+++ b/docs/howto/static-files/deployment.txt
@@ -95,7 +95,7 @@ Here's how this might look in a fabfile::
from fabric.contrib import project
# Where the static files get collected locally. Your STATIC_ROOT setting.
- env.local_static_root = '/tmp/static'
+ env.local_static_root = '/path/to/static'
# Where the static files should go remotely
env.remote_static_root = '/home/www/static.example.com'
diff --git a/docs/intro/tutorial03.txt b/docs/intro/tutorial03.txt
index 3705c0e..6275e37 100644
--- a/docs/intro/tutorial03.txt
+++ b/docs/intro/tutorial03.txt
@@ -372,7 +372,7 @@ Now let's update our ``index`` view in ``polls/views.py`` to use the template:
:filename: polls/views.py
from django.http import HttpResponse
- from django.template import RequestContext, loader
+ from django.template import loader
from .models import Question
@@ -380,10 +380,10 @@ Now let's update our ``index`` view in ``polls/views.py`` to use the template:
def index(request):
latest_question_list = Question.objects.order_by('-pub_date')[:5]
template = loader.get_template('polls/index.html')
- context = RequestContext(request, {
+ context = {
'latest_question_list': latest_question_list,
- })
- return HttpResponse(template.render(context))
+ }
+ return HttpResponse(template.render(context, request))
That code loads the template called ``polls/index.html`` and passes it a
context. The context is a dictionary mapping template variable names to Python
@@ -415,9 +415,9 @@ rewritten:
return render(request, 'polls/index.html', context)
Note that once we've done this in all these views, we no longer need to import
-:mod:`~django.template.loader`, :class:`~django.template.RequestContext` and
-:class:`~django.http.HttpResponse` (you'll want to keep ``HttpResponse`` if you
-still have the stub methods for ``detail``, ``results``, and ``vote``).
+:mod:`~django.template.loader` and :class:`~django.http.HttpResponse` (you'll
+want to keep ``HttpResponse`` if you still have the stub methods for ``detail``,
+``results``, and ``vote``).
The :func:`~django.shortcuts.render` function takes the request object as its
first argument, a template name as its second argument and a dictionary as its
diff --git a/docs/man/django-admin.1 b/docs/man/django-admin.1
index 5579072..9c372ee 100644
--- a/docs/man/django-admin.1
+++ b/docs/man/django-admin.1
@@ -2588,7 +2588,7 @@ support the \fBstdout\fP and \fBstderr\fP options. For example, you could write:
.sp
.nf
.ft C
-with open(\(aq/tmp/command_output\(aq) as f:
+with open(\(aq/path/to/command_output\(aq) as f:
management.call_command(\(aqdumpdata\(aq, stdout=f)
.ft P
.fi
diff --git a/docs/ref/contrib/gis/geos.txt b/docs/ref/contrib/gis/geos.txt
index c07d793..cc08c86 100644
--- a/docs/ref/contrib/gis/geos.txt
+++ b/docs/ref/contrib/gis/geos.txt
@@ -65,6 +65,16 @@ created by passing in the X and Y coordinates into its constructor::
>>> from django.contrib.gis.geos import Point
>>> pnt = Point(5, 23)
+All these constructors take the keyword argument ``srid``. For example::
+
+ >>> from django.contrib.gis.geos import GEOSGeometry, LineString, Point
+ >>> print(GEOSGeometry('POINT (0 0)', srid=4326))
+ SRID=4326;POINT (0.0000000000000000 0.0000000000000000)
+ >>> print(LineString((0, 0), (1, 1), srid=4326))
+ SRID=4326;LINESTRING (0.0000000000000000 0.0000000000000000, 1.0000000000000000 1.0000000000000000)
+ >>> print(Point(0, 0, srid=32140))
+ SRID=32140;POINT (0.0000000000000000 0.0000000000000000)
+
Finally, there is the :func:`fromfile` factory method which returns a
:class:`GEOSGeometry` object from a file::
@@ -428,7 +438,7 @@ The normalized version takes the distance as a float between 0 (origin) and 1
Reverse of :meth:`GEOSGeometry.project`.
-.. method:: GEOSGeometry:intersection(other)
+.. method:: GEOSGeometry.intersection(other)
Returns a :class:`GEOSGeometry` representing the points shared by this
geometry and other.
diff --git a/docs/ref/contrib/postgres/fields.txt b/docs/ref/contrib/postgres/fields.txt
index fb9ed14..ca83be8 100644
--- a/docs/ref/contrib/postgres/fields.txt
+++ b/docs/ref/contrib/postgres/fields.txt
@@ -222,9 +222,9 @@ lookups available after the transform do not change. For example::
>>> Post.objects.create(name='Third post', tags=['django', 'python', 'thoughts'])
>>> Post.objects.filter(tags__0_1=['thoughts'])
- [<Post: First post>]
+ [<Post: First post>, <Post: Second post>]
- >>> Post.objects.filter(tags__0_2__contains='thoughts')
+ >>> Post.objects.filter(tags__0_2__contains=['thoughts'])
[<Post: First post>, <Post: Second post>]
.. note::
diff --git a/docs/ref/django-admin.txt b/docs/ref/django-admin.txt
index 4c156e4..3b73f9a 100644
--- a/docs/ref/django-admin.txt
+++ b/docs/ref/django-admin.txt
@@ -663,7 +663,7 @@ for technically skilled translators to understand each message's context.
.. django-admin-option:: --keep-pot
Use the ``--keep-pot`` option to prevent Django from deleting the temporary
-.pot files it generates before creating the .po file. This is useful for
+``.pot`` files it generates before creating the .po file. This is useful for
debugging errors which may prevent the final language files from being created.
.. seealso::
@@ -1963,5 +1963,5 @@ Output redirection
Note that you can redirect standard output and error streams as all commands
support the ``stdout`` and ``stderr`` options. For example, you could write::
- with open('/tmp/command_output') as f:
+ with open('/path/to/command_output') as f:
management.call_command('dumpdata', stdout=f)
diff --git a/docs/ref/forms/validation.txt b/docs/ref/forms/validation.txt
index a8ece99..b980ea6 100644
--- a/docs/ref/forms/validation.txt
+++ b/docs/ref/forms/validation.txt
@@ -75,7 +75,7 @@ overridden:
* The form subclass's ``clean()`` method can perform validation that requires
access to multiple form fields. This is where you might put in checks such as
- "if field ``A``is supplied, field ``B`` must contain a valid email address".
+ "if field ``A`` is supplied, field ``B`` must contain a valid email address".
This method can return a completely different dictionary if it wishes, which
will be used as the ``cleaned_data``.
diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt
index 51e4b0d..74d721a 100644
--- a/docs/ref/models/fields.txt
+++ b/docs/ref/models/fields.txt
@@ -778,7 +778,7 @@ Python file object like this::
from django.core.files import File
# Open an existing file using Python's built-in open()
- f = open('/tmp/hello.world')
+ f = open('/path/to/hello.world')
myfile = File(f)
Or you can construct one from a Python string like this::
diff --git a/docs/ref/models/relations.txt b/docs/ref/models/relations.txt
index b426ae5..832f84f 100644
--- a/docs/ref/models/relations.txt
+++ b/docs/ref/models/relations.txt
@@ -110,7 +110,7 @@ Related objects reference
the ``blog`` :class:`~django.db.models.ForeignKey` doesn't have
``null=True``, this is invalid.
- .. versionchanged 1.7::
+ .. versionchanged:: 1.7
For :class:`~django.db.models.ForeignKey` objects, this method accepts
a ``bulk`` argument to control how to perform the operation.
diff --git a/docs/ref/templates/api.txt b/docs/ref/templates/api.txt
index 5272121..35677e2 100644
--- a/docs/ref/templates/api.txt
+++ b/docs/ref/templates/api.txt
@@ -628,13 +628,10 @@ example, the :class:`RequestContext` instance gets a ``ip_address`` variable::
}, [ip_address_processor])
return HttpResponse(t.render(c))
-Built-in template context processors
-------------------------------------
-
.. _context-processors:
-Context processors
-------------------
+Built-in template context processors
+------------------------------------
Here's what each of the built-in processors does:
diff --git a/docs/releases/1.7.txt b/docs/releases/1.7.txt
index 1110ee0..63eef9e 100644
--- a/docs/releases/1.7.txt
+++ b/docs/releases/1.7.txt
@@ -23,8 +23,8 @@ Python compatibility
Django 1.7 requires Python 2.7, 3.2, 3.3, or 3.4. We **highly recommend** and
only officially support the latest release of each series.
-Since Django 1.6, support for Python 2.6 has been dropped and support for
-Python 3.4 has been added.
+The Django 1.6 series is the last to support Python 2.6. Django 1.7 is the
+first release to support Python 3.4.
This change should affect only a small number of Django users, as most
operating-system vendors today are shipping Python 2.7 or newer as their default
diff --git a/docs/releases/1.8.8.txt b/docs/releases/1.8.8.txt
new file mode 100644
index 0000000..74c563a
--- /dev/null
+++ b/docs/releases/1.8.8.txt
@@ -0,0 +1,60 @@
+==========================
+Django 1.8.8 release notes
+==========================
+
+*January 2, 2016*
+
+Django 1.8.8 fixes several bugs in 1.8.7.
+
+Python 3.2 users, please be advised that we've decided to drop support for
+Python 3.2 in Django 1.8.x at the end of 2016. We won't break things
+intentionally after that, but we won't test subsequent releases against Python
+3.2 either. Upstream support for Python 3.2 ends February 2016 so we don't find
+much value in providing security updates for a version of Python that could be
+insecure. To read more about the decision and to let us know if this will be
+problematic for you, please read the `django-developers thread
+<https://groups.google.com/d/topic/django-developers/eMu5UQpUdWs/discussion>`_.
+
+Bugfixes
+========
+
+* Fixed incorrect ``unique_together`` field name generation by ``inspectdb``
+ (:ticket:`25274`).
+
+* Corrected ``__len`` query lookup on ``ArrayField`` for empty arrays
+ (:ticket:`25772`).
+
+* Restored the ability to use custom formats from ``formats.py`` with
+ ``django.utils.formats.get_format()`` and the ``date`` template filter
+ (:ticket:`25812`).
+
+* Fixed a state bug when migrating a ``SeparateDatabaseAndState`` operation
+ backwards (:ticket:`25896`).
+
+* Fixed missing ``varchar/text_pattern_ops`` index on ``CharField`` and
+ ``TextField`` respectively when using ``AlterField`` on PostgreSQL
+ (:ticket:`25412`).
+
+* Fixed a state bug when using an ``AlterModelManagers`` operation
+ (:ticket:`25852`).
+
+* Fixed a regression which prevented using a language not in Django's default
+ language list (:setting:`LANGUAGES`) (:ticket:`25915`).
+
+* ``django.views.decorators.cache.never_cache()`` now sends more persuasive
+ headers (added ``no-cache, no-store, must-revalidate`` to ``Cache-Control``)
+ to better prevent caching (:ticket:`13008`). This fixes a problem where a
+ page refresh in Firefox cleared the selected entries in the admin's
+ ``filter_horizontal`` and ``filter_vertical`` widgets, which could result
+ in inadvertent data loss if a user didn't notice that and then submitted the
+ form (:ticket:`22955`).
+
+* Fixed a regression in the admin which ignored line breaks in read-only fields
+ instead of converting them to ``<br>`` (:ticket:`25465`).
+
+* Made ``loaddata`` skip disabling and enabling database constraints when it
+ doesn't load any fixtures (:ticket:`23372`).
+
+* Fixed a crash in ``QuerySet.values()/values_list()`` after an ``annotate()``
+ and ``order_by()`` when ``values()/values_list()`` includes a field not in
+ the ``order_by()`` (:ticket:`25316`).
diff --git a/docs/releases/1.8.txt b/docs/releases/1.8.txt
index 9e741df..adc7df1 100644
--- a/docs/releases/1.8.txt
+++ b/docs/releases/1.8.txt
@@ -28,6 +28,11 @@ Python compatibility
Django 1.8 requires Python 2.7, 3.2, 3.3, 3.4, or 3.5. We **highly recommend**
and only officially support the latest release of each series.
+Django 1.8 is the first release to support Python 3.5.
+
+Due to the end of upstream support for Python 3.2 in February 2016, we won't
+test Django 1.8.x on Python 3.2 after the end of 2016.
+
What's new in Django 1.8
========================
@@ -1566,6 +1571,19 @@ pass a :class:`dict` in the ``context`` parameter instead. If you're passing a
:class:`~django.template.RequestContext`, pass the request separately in the
``request`` parameter.
+If you're using ``context_instance=RequestContext(request))`` with
+``render_to_response()``, use :func:`django.shortcuts.render`, which always
+makes ``RequestContext`` available, instead. For example::
+
+ from django.shortcuts import render_to_response
+ from django.template import RequestContext
+ render_to_response('template.html', {...}, context_instance=RequestContext(request))
+
+becomes::
+
+ from django.shortcuts import render
+ render(request, 'template.html', {...})
+
``dirs`` argument of template-finding functions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/docs/releases/index.txt b/docs/releases/index.txt
index aecfab9..ec4f0cc 100644
--- a/docs/releases/index.txt
+++ b/docs/releases/index.txt
@@ -25,6 +25,7 @@ versions of the documentation contain the release notes for any later releases.
.. toctree::
:maxdepth: 1
+ 1.8.8
1.8.7
1.8.6
1.8.5
diff --git a/docs/releases/security.txt b/docs/releases/security.txt
index 0c5e859..f6f2534 100644
--- a/docs/releases/security.txt
+++ b/docs/releases/security.txt
@@ -42,7 +42,7 @@ issued at the time and CVEs may not have been assigned.
August 16, 2006 - CVE-2007-0404
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-`CVE-2007-0404 <http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2007-0404&cid=3>`_: Filename validation issue in translation framework. `Full description <https://www.djangoproject.com/weblog/2006/aug/16/compilemessages/>`__
+`CVE-2007-0404 <https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2007-0404&cid=3>`_: Filename validation issue in translation framework. `Full description <https://www.djangoproject.com/weblog/2006/aug/16/compilemessages/>`__
Versions affected
-----------------
@@ -54,7 +54,7 @@ Versions affected
January 21, 2007 - CVE-2007-0405
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-`CVE-2007-0405 <http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2007-0405&cid=3>`_: Apparent "caching" of authenticated user. `Full description <https://www.djangoproject.com/weblog/2007/jan/21/0951/>`__
+`CVE-2007-0405 <https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2007-0405&cid=3>`_: Apparent "caching" of authenticated user. `Full description <https://www.djangoproject.com/weblog/2007/jan/21/0951/>`__
Versions affected
-----------------
@@ -70,7 +70,7 @@ security process. These are listed below.
October 26, 2007 - CVE-2007-5712
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-`CVE-2007-5712 <http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2007-5712&cid=3>`_: Denial-of-service via arbitrarily-large ``Accept-Language`` header. `Full description <https://www.djangoproject.com/weblog/2007/oct/26/security-fix/>`__
+`CVE-2007-5712 <https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2007-5712&cid=3>`_: Denial-of-service via arbitrarily-large ``Accept-Language`` header. `Full description <https://www.djangoproject.com/weblog/2007/oct/26/security-fix/>`__
Versions affected
-----------------
@@ -82,7 +82,7 @@ Versions affected
May 14, 2008 - CVE-2008-2302
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-`CVE-2008-2302 <http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2008-2302&cid=3>`_: XSS via admin login redirect. `Full description <https://www.djangoproject.com/weblog/2008/may/14/security/>`__
+`CVE-2008-2302 <https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2008-2302&cid=3>`_: XSS via admin login redirect. `Full description <https://www.djangoproject.com/weblog/2008/may/14/security/>`__
Versions affected
-----------------
@@ -94,7 +94,7 @@ Versions affected
September 2, 2008 - CVE-2008-3909
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-`CVE-2008-3909 <http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2008-3909&cid=3>`_: CSRF via preservation of POST data during admin login. `Full description <https://www.djangoproject.com/weblog/2008/sep/02/security/>`__
+`CVE-2008-3909 <https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2008-3909&cid=3>`_: CSRF via preservation of POST data during admin login. `Full description <https://www.djangoproject.com/weblog/2008/sep/02/security/>`__
Versions affected
-----------------
@@ -106,7 +106,7 @@ Versions affected
July 28, 2009 - CVE-2009-2659
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-`CVE-2009-2659 <http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2009-2659&cid=3>`_: Directory-traversal in development server media handler. `Full description <https://www.djangoproject.com/weblog/2009/jul/28/security/>`__
+`CVE-2009-2659 <https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2009-2659&cid=3>`_: Directory-traversal in development server media handler. `Full description <https://www.djangoproject.com/weblog/2009/jul/28/security/>`__
Versions affected
-----------------
@@ -117,7 +117,7 @@ Versions affected
October 9, 2009 - CVE-2009-3965
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-`CVE-2009-3965 <http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2009-3695&cid=3>`_: Denial-of-service via pathological regular expression performance. `Full description <https://www.djangoproject.com/weblog/2009/oct/09/security/>`__
+`CVE-2009-3965 <https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2009-3695&cid=3>`_: Denial-of-service via pathological regular expression performance. `Full description <https://www.djangoproject.com/weblog/2009/oct/09/security/>`__
Versions affected
-----------------
@@ -128,7 +128,7 @@ Versions affected
September 8, 2010 - CVE-2010-3082
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-`CVE-2010-3082 <http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2010-3082&cid=3>`_: XSS via trusting unsafe cookie value. `Full description <https://www.djangoproject.com/weblog/2010/sep/08/security-release/>`__
+`CVE-2010-3082 <https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2010-3082&cid=3>`_: XSS via trusting unsafe cookie value. `Full description <https://www.djangoproject.com/weblog/2010/sep/08/security-release/>`__
Versions affected
-----------------
@@ -138,7 +138,7 @@ Versions affected
December 22, 2010 - CVE-2010-4534
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-`CVE-2010-4534 <http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2010-4534&cid=3>`_: Information leakage in administrative interface. `Full description <https://www.djangoproject.com/weblog/2010/dec/22/security/>`__
+`CVE-2010-4534 <https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2010-4534&cid=3>`_: Information leakage in administrative interface. `Full description <https://www.djangoproject.com/weblog/2010/dec/22/security/>`__
... 1124 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