Commit Graph

11699 Commits

Author SHA1 Message Date
Carl Meyer a9cced7aec Fix another flake8 warning.
I don't agree with flake8 here about the right indentation, but as long as
we're using it, we should stick to it. I don't want to disable its hanging
indent checks just because of this case.
2014-11-22 14:21:32 -07:00
Aymeric Augustin 7331788300 Avoided rewrapping Contexts in render_to_response.
This change preserves backwards-compatibility for a very common misuse
of render_to_response which even occurred in the official documentation.

It fixes that misuse wherever it happened in the code base and docs.

Context.__init__ is documented as accepting a dict and nothing else.
Since Context is dict-like, Context(Context({})) could work to some
extent. However, things get complicated with RequestContext and that
gets in the way of refactoring the template engine. This is the real
rationale for this change.
2014-11-22 17:58:38 +01:00
Claude Paroz b38637d581 Fixed #23887 -- Returned Bad Request for multipart parsing fails
Thanks Antti Häyrynen and Tim Graham for the report, and Aymeric
Augustin for the review.
2014-11-22 14:23:37 +01:00
Collin Anderson d4ea4eea79 Fixed #23889 -- Added more usage of quote_name_unless_alias() to avoid deprecation warnings. 2014-11-21 16:44:50 -05:00
Simon Charette c7087bc777 Fixed #23862 -- Made ManyToManyRel.get_related_field() respect to_field. 2014-11-21 16:02:31 -05:00
Simon Charette a7c3d0f288 Fixed typo in forms/models.py comment. 2014-11-21 15:59:09 -05:00
Berker Peksag 343162410f Fixed #21753 -- Raised exception when both `form_class` and `fields` are specified. 2014-11-21 14:23:17 -05:00
Andrzej Pragacz 72729f844e Fixed #23794 -- Fixed migrations crash when removing a field that's part of index/unique_together. 2014-11-21 10:55:19 -05:00
Tim Heap 5b17dcd8ef Fixed #23883 -- Stopped flatatt modifying its argument 2014-11-21 09:45:08 +01:00
Brad Walker 54d3dcbc51 Removed reduce() usage in makemigrations; refs #23796.
A lambda all_items_equal() replaced a reduce() that was broken for potential
3+-way merges. A reduce(operator.eq, ...) accumulates bools and can't
generically check equality of all items in a sequence:

>>> bool(reduce(operator.eq, [('migrations', '0001_initial')] * 3))
False

The code now counts the number of common ancestors to calculate slice offsets
for the branches. Each branch shares the same number of common ancestors.

The common_ancestor for loop statement had incomplete branch coverage.
2014-11-20 14:33:30 -05:00
Brad Walker cfa26f29bd Reduced reduce() usage; refs #23796.
django.core.exceptions.ValidationError.messages() and
django.db.backends.schema.BaseDatabaseSchemaEditor._alter_field():
Replaced reduce(operator.add, ...) w/uncoupled, explicit sum()
2014-11-20 14:31:14 -05:00
Anssi Kääriäinen 5c481db295 Fixed #23605 -- Fixed nested subquery regression
Added relabeled_clone() method to sql.Query to fix the problem. It
manifested itself in rare cases where at least double nested subquery's
filter condition might target non-existing alias.

Thanks to Trac alias ris for reporting the problem.
2014-11-20 13:38:08 -05:00
Patryk Zawadzki 21e21c7bc2 Fixed #23844 -- Used topological sort for migration operation dependency resolution.
This removes the concept of equality between operations to guarantee
compatilibity with Python 3.

Python 3 requires equality to result in identical object hashes. It's
impossible to implement a unique hash that preserves equality as
operations such as field creation depend on being able to accept
arbitrary dicts that cannot be hashed reliably.

Thanks Klaas van Schelven for the original patch in
13d613f800.
2014-11-20 12:49:49 -05:00
Claude Paroz 1a63093e22 Added AutoField introspection for PostgreSQL
Refs #23748.
2014-11-20 16:13:58 +01:00
Claude Paroz 11662022be Added AutoField introspection for MySQL
Refs #23748.
2014-11-20 16:13:58 +01:00
Berker Peksag 788fa9fffa Fixed #12098 -- Simplified HttpRequest.__repr__(). 2014-11-20 08:45:11 -05:00
Carl Meyer d6e2bbe734 Fixed #23876 -- Removed dead code in SQLAggregateCompiler. 2014-11-20 04:18:08 -07:00
Carl Meyer d2bcb05980 Fixed #23873 -- Improved GIS error message when GEOS is not installed.
Thanks Claude for writing the patch.
2014-11-19 19:23:13 -07:00
Carl Meyer ab2819aa7b Fixed #23410 -- Avoided unnecessary rollbacks in related apps when migrating backwards. 2014-11-19 16:11:44 -07:00
Carl Meyer e7b9a58b08 Fixed #21794 -- Removed deprecation warning for abstract models outside an app. 2014-11-19 15:56:04 -07:00
Carl Meyer 4932a7b8e0 Fixed GIS tests to again skip without error when GEOS is not installed. 2014-11-19 14:29:05 -07:00
Tim Graham 5bcd292098 Fixed #23871 -- Removed promotion of MySQL warnings to errors in DEBUG mode. 2014-11-19 16:07:49 -05:00
Aymeric Augustin 45db7f7db8 Replaced caching of a property with @cached_property. 2014-11-19 21:53:24 +01:00
Aymeric Augustin 9d3d1a0321 Simplified caching of supported languages. 2014-11-19 21:35:40 +01:00
Aymeric Augustin 0900815097 Simplified caching of the default exception reporter filter.
Also simplified the logic under the assumption that a false-ish object
won't have an exception_reporter_filter attribute.
2014-11-19 21:35:40 +01:00
Aymeric Augustin f88ad710fa Simplified caching of template context processors. 2014-11-19 21:35:39 +01:00
Aymeric Augustin a97e72aaab Simplified caching of templatetags modules. 2014-11-19 21:35:39 +01:00
Aymeric Augustin e23240474b Simplified caching of get_default_timezone(). 2014-11-19 21:35:39 +01:00
Aymeric Augustin dca33ac15d Simplified caching of password hashers.
load_hashers cached its result regardless of its password_hashers
argument which required fragile cache invalidation. Remove that
argument in favor of @override_settings and triggering cache
invalidation with a signal.
2014-11-19 21:35:39 +01:00
Carl Meyer 0eba8bd8f6 Fixed GeoSQLCompiler to pass itself correctly to column as_sql. 2014-11-19 08:33:38 -07:00
Carl Meyer 84d88f5cbe Removed a deprecated use of SQLCompiler as quote_name in GIS. 2014-11-19 08:03:48 -07:00
Stratos Moros cf7a2a000e Fixed #22248 -- Made RenameModel reversible 2014-11-19 14:11:35 +02:00
Carl Meyer 08fbbaa45b Deprecated calling a SQLCompiler instance. 2014-11-18 19:47:16 -07:00
Anton Baklanov d63703f1cd Fixed #18714 -- Added 'fuzzy' compilemessages option 2014-11-18 22:44:16 +01:00
Tillmann Karras d188101319 Fixed #23799 -- Made makemigrations respect --no-optimize.
Thanks to yamila-moreno for the idea of a skip message.
2014-11-18 07:37:06 +01:00
Aymeric Augustin 4b9eb7602d Normalized check that ALLOWED_INCLUDE_ROOTS is a tuple. 2014-11-17 22:49:01 +01:00
Markus Holtermann 7b4a994599 Fixed #23859 -- Fixed a migration crash when a field is renamed that is part of an index_together 2014-11-17 19:15:07 +01:00
twidi 19ae13d9ed Avoided unneeded calls to state.render() in migrations. 2014-11-17 18:44:09 +01:00
twidi 82aca216e1 Reordered condition to avoid calling allow_migrate() if unneeded. 2014-11-17 18:32:42 +01:00
Anssi Kääriäinen 4252a14c39 Moved bilateral transform fetching to models.lookups 2014-11-17 18:04:08 +01:00
Claude Paroz fc36437434 Added assertion error message for test_make_line
Refs #23842. Thanks Thomas Chaumeny for the suggestion.
2014-11-17 14:17:08 +01:00
Claude Paroz 684b2077b3 Improved readability of negative condition in makemessages
Thanks Berker Peksag for the suggestion.
2014-11-17 13:42:14 +01:00
Claude Paroz 6a05f0dfe3 Simplified handle_extensions management utility
makemessages now doesn't need any special ignoring logic, after
commit bb4a92d784.
2014-11-17 09:24:56 +01:00
Ilja Maas bb4a92d784 Fixed #23840 -- Fixed makemessages find_files method
Changed the handling of extensions to be used for gettext. Now
obeying the --extension argument. find_files now only find the
given or default extensions and puts only these in the
TranslatableFiles. As a result there are no more confusing messages
for filetypes (extension) not handled by makemessages.
2014-11-17 09:21:24 +01:00
Aymeric Augustin fab26cf5e0 Removed support for function-based template loaders.
They were deprecated in Django 1.2 but not all the supporting code was
removed in Django 1.4. Since the remaining code was unlikely to be
functional (pun intended) e.g. it would crash unless the loader
function had an is_usable attribute, this commit completes the removal
immediately instead of starting another deprecation path.
2014-11-16 22:18:33 +01:00
Aymeric Augustin e87bee6f50 Used get_template_loaders in the cached loader.
This ensures that enabling the cached loader doesn't change behavior.

(Before this commit, it did when the list contained unusable loaders.)
2014-11-16 21:41:44 +01:00
Aymeric Augustin 9eeb788cfb Refactored getting the list of template loaders.
This provides the opportunity to move utility functions specific to the
Django Template Language outside of django.template.loader.
2014-11-16 21:41:44 +01:00
Aymeric Augustin 1851dcf377 Deprecated function-based loaders. 2014-11-16 21:41:42 +01:00
Aymeric Augustin 0bf99193f8 Removed obsolete comment.
It didn't account for class-based template loaders.
2014-11-16 21:40:54 +01:00
Aymeric Augustin b503fee7ec Removed override_template_loaders and override_with_test_loader.
They can be replaced with override_settings and that makes the
corresponding tests much more obvious.
2014-11-16 21:40:50 +01:00
Aymeric Augustin d58597a7b8 Refactored listing template subdirectories in apps.
This change has the nice side effect of removing code that ran at import
time and depended on the app registry at module level -- a notorious
cause of AppRegistryNotReady exceptions.
2014-11-16 21:28:43 +01:00
Aymeric Augustin cd7146debe Removed skip_template argument of locmem.Loader.load_template_source.
It didn't do anything, wasn't documented and wasn't used anywhere.
2014-11-16 21:28:37 +01:00
Aymeric Augustin c211c59b4a Removed the "test:" prefix from locmem template identifiers.
Since it isn't branded as a test utility any more and could be used for
other purposes than test code, that prefix no longer makes sense.

It wasn't used anywhere either.
2014-11-16 21:28:31 +01:00
Aymeric Augustin 2577ae6a08 Moved all template loaders under django.template.loaders.
Reformatted the code of base.Loader according to modern standards.

Turned the test template loader into a regular locmem.Loader -- but
didn't document it.

Added a normal deprecation path for BaseLoader which is a public API.

Added an accelerated deprecation path for TestTemplateLoader which is
a private API.
2014-11-16 21:28:26 +01:00
Aymeric Augustin cffa559082 Fixed regression in 4dc4d12e. Refs #21598.
That commit contained a mistake that resulted in the use_cached_loader
option of override_with_test_loader being ignored. As a consequence some
configurations weren't exercised any more by the test suite.
2014-11-16 21:25:09 +01:00
Karen Tracey dec93d8991 Fixed #21612 -- Made QuerySet.update() respect to_field 2014-11-16 15:44:13 +01:00
Josh Smeaton f61256da3a Renamed qn to compiler 2014-11-16 13:19:34 +01:00
Marc Tamlyn 4024dd0c98 Merge pull request #3526 from gregorth/ticket_23585
Fixed #23585 - Corrected internal comment.
2014-11-16 09:24:22 +00:00
Berker Peksag d2d6c0c097 Fixed #21363 -- Added datetime.timedelta support to TimestampSigner.unsign(). 2014-11-15 19:36:33 +01:00
Carl Meyer 1ed9b9e2e2 Merge pull request #3536 from Zweedeend/ticket_23837
Fixes #23837: Replace list with deque in migration-planner for improved performance.
2014-11-15 18:56:52 +01:00
Claude Paroz 35dac5070b Added a new GeoJSON serialization format for GeoDjango
Thanks Reinout van Rees for the review.
2014-11-15 18:07:18 +01:00
Andrew Godwin c5def493d0 Fixed #23835: Changed circular dependency in DFS to be less infinite 2014-11-15 17:39:02 +01:00
Erik Romijn c1584e1df4 Refs #23793 -- Fixed test failure after password reset messages clarification 2014-11-15 17:05:24 +01:00
Marc Tamlyn 9a5a4361c5 Merge pull request #3531 from ddaan/ticket_23834
fixed #23834 -- added test and fix to check for default null on ArrayField
2014-11-15 15:37:03 +00:00
Niels Kouwenhoven fefb77934e Fixes #23837: Replace list.pop(0) by deque.popleft() in dfs function in migrations 2014-11-15 16:34:20 +01:00
Yigit Guler 9dde0a211e Fixed #23793 -- Clarified password reset messages. 2014-11-15 16:29:13 +01:00
Daan Vielen a7c58eaca4 added test and fix to check for default null on ArrayField 2014-11-15 15:20:11 +00:00
Tim Graham 83d104d61a Revert "Use topological sort for migration operation dependency resolution"
This commit broke the tests on Python 3.

This reverts commit 13d613f800.
2014-11-15 15:28:04 +01:00
Josh Smeaton f59fd15c49 Fixed #14030 -- Allowed annotations to accept all expressions 2014-11-15 14:00:43 +00:00
Klaas van Schelven 13d613f800 Use topological sort for migration operation dependency resolution
rather than an ad-hoc algorithm
2014-11-15 14:45:42 +01:00
Grzegorz Slusarek b4bb5cd0a3 Fixed #23585 - Corrected internal comment.
Removed misleading comment and provide correct one, explaining
idea behind hardcoded CSRF template context processor.
2014-11-15 14:07:31 +01:00
Berker Peksag d552da1f8d Fixed #22407 -- Added AdminEmailHandler.send_mail(). 2014-11-15 09:38:19 +01:00
Michael Manfre a305695f28 Merge pull request #3481 from manfre/ticket-16358
Fixed #16358 - Made memcache backend delete old value on a failure to set.
2014-11-13 22:10:22 -05:00
Tim Graham c24a2e6cbd Fixed #23765 -- Removed BooleanField default check which often yielded false positives. 2014-11-13 20:12:29 +01:00
Tim Graham 7ef81b5cdd Removed thread customizations of six which are now built-in. 2014-11-13 10:30:53 +01:00
Michael Manfre bc8abe36ba Fixed #16358 - Made memcache backend delete old value on a failure to set.
Default Memcached configuration allows for a maximum object of 1MB and
will fail to set the key if it is too large. The key will be deleted from
memcached if it fails to be set. This is needed to avoid an issue with
cache_db session backend using the old value stored in memcached, instead
of the newer value stored in the database.
2014-11-13 00:46:03 -05:00
Baptiste Mispelon bfb11b9562 Fixed #23795 -- Fixed a regression in custom form fields
Custom form fields having a `queryset` attribute but no
`limit_choices_to` could no longer be used in ModelForms.

Refs #2445.

Thanks to artscoop for the report.
2014-11-12 22:38:18 +01:00
Aymeric Augustin f742c653e0 Removed return from __init__.
__init__ isn't allowed to return anything other than None and it isn't
common practice to include a return statement.
2014-11-12 21:26:31 +01:00
Tim Graham aa77e90aa9 Remove Field.get_validator_unique_lookup_type()
Usage of this method was removed pre 1.0 (c2ba59fc).
2014-11-12 20:11:40 +01:00
Tim Graham 42b5e4feea Fixed #23730 -- Moved support for SimpleCookie HIGHEST_PROTOCOL pickling to http.cookie.
This fix is necessary for Python 3.5 compatibility (refs #23763).

Thanks Berker Peksag for review.
2014-11-12 19:04:45 +01:00
Anssi Kääriäinen 4e9a6c94e6 Removed extra enumerate() from Query.setup_joins() 2014-11-12 13:22:08 +02:00
Jozef Knaperek c56c42b5c0 Fixed #22967 -- Made Model._do_update consistent
Made _do_update behave more strictly according to its docs,
including a corner case when specific concurent updates are
executed and select_on_save is set.
2014-11-12 12:53:30 +02:00
Anssi Kääriäinen d647764a53 Improved Query.names_to_path docstring 2014-11-12 12:40:55 +02:00
Aymeric Augustin 3bc7a14ea5 Normalized opening a file and decoding its content.
`io.open` is required on Python 2.7. Just `open` would work on Python 3.
2014-11-11 22:54:27 +01:00
Aymeric Augustin 95b8323ac2 Removed import forgotten in previous commit. 2014-11-11 22:54:26 +01:00
Claude Paroz 5ec367ccdd Fixed #23788 -- Used new JavaScript support in recent gettext
JavaScript string extraction support has been added in gettext
0.18.3.
Thanks Aymeric Augustin for the review.
2014-11-11 22:52:30 +01:00
Aymeric Augustin b8ba73cd0c Raised SuspiciousFileOperation in safe_join.
Added a test for the condition safe_join is designed to prevent.

Previously, a generic ValueError was raised. It was impossible to tell
an intentional exception raised to implement safe_join's contract from
an unintentional exception caused by incorrect inputs or unexpected
conditions. That resulted in bizarre exception catching patterns, which
this patch removes.

Since safe_join is a private API and since the change is unlikely to
create security issues for users who use it anyway -- at worst, an
uncaught SuspiciousFileOperation exception will bubble up -- it isn't
documented.
2014-11-11 19:05:14 +01:00
averybigant b7a5b6ab86 Fixed #23750 -- Allowed core.checks.register to be used as a function 2014-11-11 16:29:32 +01:00
Anssi Kääriäinen b3fd39f7c8 Simplified Query.build_lookup() 2014-11-11 08:14:29 +02:00
Aymeric Augustin b239c3d27e Fixed negligible formatting error. 2014-11-10 21:41:35 +01:00
Thomas Chaumeny 498ae3a360 Removed legacy code from old transaction system 2014-11-10 18:28:46 +01:00
Thomas Chaumeny 88b2a20f04 Simplified MySQL storage engine detection using INFORMATION_SCHEMA.ENGINES table
Query the table introduced in MySQL 5.1; refs #23144.
2014-11-10 18:16:14 +01:00
Luke Plant b748a8bc67 Fixed #23789 -- TemplateResponse handles context differently from render 2014-11-10 14:47:45 +00:00
Markus Holtermann c7c098cf97 Fixed #23770 -- Changed serialization strategy for floats with respect to NaN and Inf
Thanks to w0rp for the report
2014-11-06 15:30:30 +01:00
Tim Graham b07aa52e8a Added a dummy class for HTMLParserError; refs #23763. 2014-11-05 09:54:35 -05:00
Tim Graham 81477c91f6 Updated six to 1.8.0. 2014-11-04 20:38:38 -05:00
Berker Peksag df0523debc Fixed #23531 -- Added CommonMiddleware.response_redirect_class. 2014-11-04 17:56:57 -05:00
Peter Inglesby 74e1980cf9 Fixed #13181 -- Added support for callable choices to forms.ChoiceField
Thanks vanschelven and expleo for the initial patch.
2014-11-04 11:23:58 -05:00
Marc Tamlyn 36f514f065 Added HStoreField.
Thanks to `django-hstore` for inspiration in some areas, and many people
for reviews.
2014-11-04 09:26:40 +00:00
Veres Lajos a71a2ea756 Fixed typos using https://github.com/vlajos/misspell_fixer 2014-11-03 20:59:30 -05:00