Commit Graph

2947 Commits

Author SHA1 Message Date
Anssi Kääriäinen 55da775ce1 Fixed #17541 -- Fixed non-saved/nullable fk querying 2013-01-08 21:02:38 +02:00
Claude Paroz 34ee7d9875 Updated deprecated test assertions 2013-01-08 19:08:15 +01:00
Anssi Kääriäinen 23ca3a0194 Fixed #16759 -- Remove use of __deepcopy__ in qs.clone()
The original problem was that queryset cloning was really expensive
when filtering with F() clauses. The __deepcopy__ went too deep copying
_meta attributes of the models used. To fix this the use of
__deepcopy__ in qs cloning was removed.

This commit results in some speed improvements across the djangobench
benchmark suite. Most query_* tests are 20-30% faster, save() is 50%
faster and finally complex filtering situations can see 2x to order
of magnitude improvments.

Thanks to Suor, Alex and lrekucki for valuable feedback.
2013-01-08 19:17:13 +02:00
Claude Paroz c698c55966 Created special PostgreSQL text indexes when unique is True
Refs #19441.
2013-01-07 17:54:30 +01:00
Anssi Kääriäinen a2396a4c8f Fixed #19173 -- Made EmptyQuerySet a marker class only
The guarantee that no queries will be made when accessing results is
done by new EmptyWhere class which is used for query.where and having.

Thanks to Simon Charette for reviewing and valuable suggestions.
2013-01-06 19:18:28 +02:00
Claude Paroz b740da3504 Fixed #19192 -- Allowed running tests with dummy db backend
Thanks Simon Charette for the initial patch, and Jan Bednařík for
his work on the ticket.
2013-01-04 13:55:20 +01:00
Claude Paroz ffa50ca352 Fixed #19382 -- Stopped smtp backend raising exception when already closed
Thanks Sebastian Noack for the report and the initial patch.
2013-01-03 20:41:45 +01:00
Claude Paroz 1b3f832ab7 Fixed #19134 -- Allowed closing smtp backend when the server is stopped
Thanks Sebastian Noack for the report and the initial patch.
2013-01-03 18:49:00 +01:00
Simon Charette 3fc43c964e Fixed #19545 -- Make sure media/is_multipart work with empty formsets 2013-01-03 15:16:23 +01:00
Aymeric Augustin feb41c3246 Modernized middleware tests.
* Used override_settings consistently -- changes to DEBUG could leak.
* Took advantage of assertRaisesRegexp.
* Fixed indentation -- some code was indented at 2 spaces.
2013-01-01 23:00:34 +01:00
Anton Baklanov 3aa4b8165d Fixed #19457 -- ImageField size detection failed for some files.
This was caused by PIL raising a zlib truncated stream error since we fed
the parser with chunks instead of the whole image.
2013-01-01 11:54:56 +01:00
Aymeric Augustin bacb097ac3 Fixed #19519 again -- Regression in LiveServerTestCase after fd1279a4. 2013-01-01 10:14:11 +01:00
Julien Phalip 9180146d21 Fixed #19453 -- Ensured that the decorated function's arguments are obfuscated in the @sensitive_variables decorator's frame, in case the variables associated with those arguments were meant to be obfuscated from the decorated function's frame.
Thanks to vzima for the report.
2012-12-31 09:34:08 -08:00
Aymeric Augustin acc5396e6d Fixed #19519 -- Fired request_finished in the WSGI iterable's close(). 2012-12-31 12:47:34 +01:00
Claude Paroz d11038acb2 Fixed #19537 -- Made CheckboxInput._has_changed handle 'False' string
Thanks dibrovsd@gmail.com for the report.
2012-12-31 10:18:59 +01:00
Julien Phalip cee40c7d79 Added further flexibility to ModelAdmin for controlling post-save redirections.
Refs #19505.
2012-12-30 21:33:21 -08:00
Aymeric Augustin 4e5369a596 Silenced warnings in the tests of deprecated features. 2012-12-29 22:32:07 +01:00
Aymeric Augustin ef017a5f00 Advanced pending deprecation warnings.
Also added stacklevel argument, fixed #18127.
2012-12-29 21:59:07 +01:00
Aymeric Augustin 2ecf56ea3f Removed legacy ways of calling cache_page. 2012-12-29 21:59:07 +01:00
Aymeric Augustin 9f9a4cdecd Removed truncate_words and truncate_html_words. 2012-12-29 21:59:07 +01:00
Aymeric Augustin 4a6490a4a0 Removed HttpRequest.raw_post_data. 2012-12-29 21:59:07 +01:00
Aymeric Augustin d1c72d9e01 Removed django.core.management.setup_environ and execute_manager. 2012-12-29 21:59:07 +01:00
Aymeric Augustin f27a4ee327 Removed django.contrib.localflavor.
Each localflavor lives on as a separate app.
2012-12-29 21:59:06 +01:00
Aymeric Augustin 02f3daadd6 Removed interpolation of post_url_continue in the admin. 2012-12-29 21:58:12 +01:00
Aymeric Augustin fb9f1b9bfb Removed backwards-compatibility shim for #16288.
Also unit-tested django.utils.log.RequireDebugTrue for consistency.
2012-12-29 21:58:12 +01:00
Anssi Kääriäinen 13a2b11425 Avoided having an indexed TextField installed unless using postgres
An index on TextField results in a warning message when running tests
on MySQL or SQLite, and the test using the TextField was PostgreSQL
only in any case.
2012-12-29 16:30:17 +02:00
Aymeric Augustin e9c24bef74 Fix #19524 -- Incorrect caching of parents of unsaved model instances.
Thanks qcwxezdas for the report. Refs #13839.
2012-12-28 23:34:54 +01:00
Ramiro Morales ad769efa85 Expanded tests added when fixing #14529.
To make sure changes in 35d1cd0 don't break anything. Refs #19505.
2012-12-24 17:48:48 -03:00
Aymeric Augustin 1c8be95a86 Prevented caching of streaming responses.
The test introduced in 4b278131 accidentally passed because of a
limitation of Python < 3.3.

Refs #17758, #7581.
2012-12-24 20:28:07 +01:00
Julien Phalip 35d1cd0b28 Fixed #19505 -- A more flexible implementation for customizable admin redirect urls.
Work by Julien Phalip.

Refs #8001, #18310, #19505. See also 0b908b92a2.
2012-12-24 15:44:19 -03:00
Aymeric Augustin e8f07f0378 Fixed a randomly failing test under Python 3.
Refs #17758.
2012-12-24 11:25:58 +01:00
Luke Plant 1ae64e96c1 Fixed a dependence on set-ordering in tests 2012-12-24 01:33:44 +00:00
Luke Plant c31c2c92b8 Made admin generated changelist URLs independent of dict ordering 2012-12-24 01:33:24 +00:00
Ian Clelland b9fc70141a Don't rely on dictionary ordering in tests 2012-12-24 00:45:58 +00:00
Ian Clelland 585aa11d23 Use HTML parser to compare html snippets 2012-12-24 00:26:09 +00:00
Ian Clelland 8d35fd4c32 Use new TestCase methods for equality comparisons 2012-12-24 00:24:14 +00:00
Aymeric Augustin 1e4a27d087 Fixed #19468 -- Decoded request.path correctly on Python 3.
Thanks aliva for the report and claudep for the feedback.
2012-12-22 13:32:39 +01:00
Anssi Kääriäinen d407164c04 Fixed #18854 -- Join promotion in disjunction cases
The added promotion logic is based on promoting any joins used in only
some of the childs of an OR clause unless the join existed before the
OR clause addition.
2012-12-20 21:45:15 +02:00
Anssi Kääriäinen 3dcd435a0e Fixed #19500 -- Solved a regression in join reuse
The ORM didn't reuse joins for direct foreign key traversals when using
chained filters. For example:
    qs.filter(fk__somefield=1).filter(fk__somefield=2))
produced two joins.

As a bonus, reverse onetoone filters can now reuse joins correctly

The regression was caused by the join() method refactor in commit
68847135bc

Thanks for Simon Charette for spotting some issues with the first draft
of the patch.
2012-12-20 21:27:00 +02:00
Russell Keith-Magee c04c03daa3 Fixed #19401 -- Ensure that swappable model references are case insensitive.
This is necessary because get_model() checks are case insensitive, and if the swapable check isn't, the
swappable logic gets tied up in knots with models that are partially swapped out.

Thanks to chris@cogdon.org for the report and extensive analysis, and Preston for his work on the draft patch.
2012-12-20 16:10:19 +08:00
Claude Paroz 55972ee5c7 Fixed #19441 -- Created PostgreSQL varchar index when unique=True
Thanks Dylan Verheul for the report and Anssi Kääriäinen for the
review.
2012-12-18 09:56:30 +01:00
Anssi Kääriäinen 85712a5355 Made sure connections are actually closed in backends tests 2012-12-16 23:26:16 +02:00
Claude Paroz ed711c4bd5 Fixed #19483 -- Improved import error message in contrib.comments
Thanks Valentin Lorentz for the report and the suggested fix.
2012-12-16 21:12:45 +01:00
Anssi Kääriäinen 69597e5bcc Fixed #10790 -- Refactored sql.Query.setup_joins()
This is a rather large refactoring. The "lookup traversal" code was
splitted out from the setup_joins. There is now names_to_path() method
which does the lookup traveling, the actual work of setup_joins() is
calling names_to_path() and then adding the joins found into the query.

As a side effect it was possible to remove the "process_extra"
functionality used by genric relations. This never worked for left
joins. Now the extra restriction is appended directly to the join
condition instead of the where clause.

To generate the extra condition we need to have the join field
available in the compiler. This has the side-effect that we need more
ugly code in Query.__getstate__ and __setstate__ as Field objects
aren't pickleable.

The join trimming code got a big change - now we trim all direct joins
and never trim reverse joins. This also fixes the problem in #10790
which was join trimming in null filter cases.
2012-12-16 17:23:26 +02:00
Russell Keith-Magee 9facca28b6 Corrected tests depending on the error message on the AuthenticationForm.
Refs #19368, and the fix introduced in 27f8129d64.
2012-12-16 07:18:45 +08:00
Anssi Kääriäinen 7eba5fbc02 Fixed a couple of stale tests caused by patch for #19462
Commit was 088d3bc2f8
2012-12-13 15:02:08 +02:00
Anssi Kääriäinen 088d3bc2f8 Fixed #19462 -- Made assertQuerysetEqual detect undefined ordering
If there are more than one values to compare against and the qs isn't
ordered then assertQuerysetEqual will raise a ValueError.
2012-12-13 13:33:11 +02:00
Florian Apolloner 7e97f4f510 Fixed an order dependant test failure. 2012-12-11 16:25:47 +01:00
Florian Apolloner 1eb0da1c5b Fixed a test failure in the comment tests. 2012-12-10 23:34:51 +01:00
Florian Apolloner 27560924ec Fixed a security issue in get_host.
Full disclosure and new release forthcoming.
2012-12-10 22:11:40 +01:00