Commit Graph

4184 Commits

Author SHA1 Message Date
Preston Timmons 751b007c98 Modified test_utils to work with unittest2 discovery. 2013-04-12 15:00:48 -06:00
Preston Timmons cdf520ee86 Modified forms_tests to work with unittest2 discovery. 2013-04-12 15:00:17 -06:00
Claude Paroz b04fd579d5 Fixed #20237 (again) Allowed binary parameter to assertContains 2013-04-12 20:12:42 +02:00
Baptiste Mispelon ab686022f8 Fixed #20211: Document backwards-incompatible change in BoundField.label_tag
Also cleaned up label escaping and consolidated the test suite regarding
label_tag.
2013-04-12 10:17:17 +02:00
Claude Paroz fe01404bb9 Fixed #20237 -- Reenabled assertContains with binary parameter
Thanks Baptiste Mispelon for the review.
2013-04-11 10:38:24 +02:00
Baptiste Mispelon e7b9c11c3f Fixed #20231 -- Don't use allow_lazy on smart_split 2013-04-10 13:05:29 +02:00
Claude Paroz 118faa0893 Made usage of assertTemplateUsed in admin_views tests
Thanks Baptiste Mispelon for the suggestion.
2013-04-10 10:16:15 +02:00
Baptiste Mispelon f69396665c Fix admin_views tests after commit 3be368c73e. 2013-04-08 22:02:18 +02:00
Tobias McNulty 161c4da588 Fixed #14019 -- Initialize `SQLInsertCompiler.return_id` attribute. 2013-04-08 13:41:36 -06:00
Baptiste Mispelon f9dc1379b8 Fix #15126: Better error message when passing invalid options to ModelForm.Meta. 2013-04-07 19:08:53 +02:00
Simon Charette 216580e034 Fixed #20207 -- Handle ManyToManyField with a unicode name correctly. 2013-04-05 15:09:53 -04:00
Baptiste Mispelon c250f9c99b Fixed #20038 -- Better error message for host validation. 2013-04-03 14:27:20 -06:00
Preston Timmons 8ce46375ae Move last remaining tests out of models.py files; prep for test discovery. 2013-04-02 19:00:55 -06:00
Claude Paroz edc782b7b5 Relaxed time frame check in test_strip_tags 2013-04-01 22:53:04 +02:00
Julien Phalip 2f81a0ca65 Fixed #20169 -- Ensured that the WSGI request's path is correctly based on the `SCRIPT_NAME` environment parameter or the `FORCE_SCRIPT_NAME` setting, regardless of whether or not those have a trailing slash. Thanks to bmispelon for the review. 2013-04-01 12:04:44 -07:00
Claude Paroz 8c41bd93c2 Fixed #16737 -- Support non-ascii column names in inspectdb
Thanks moof at metamoof.net for the report.
2013-04-01 19:59:57 +02:00
Claude Paroz 2817a29d90 Imported unittest from django.utils in util_tests
Without this, the 'new' assertion methods are not present with
Python 2.6.
2013-04-01 19:59:57 +02:00
Claude Paroz dcf563071f Fixed #5014 -- Guessed max_digits and decimal_places for SQLite
Decimal is treated as float on SQLite, hence inspectdb can only
guess max_digits and decimal_places arguments.
2013-04-01 18:32:57 +02:00
Claude Paroz 51028f50b6 Fixed getting max_digits for MySQL decimal fields
Refs #5014.
2013-04-01 18:17:00 +02:00
Claude Paroz a01361b5ae Added more tests for strip_tags utility
Refs #19237.
2013-04-01 16:48:47 +02:00
Claude Paroz b474ffe63a Fixed #20172 -- Ensured urlize supports IPv4/IPv6 addresses
Thanks Marc Aymerich for the report and the initial patch.
2013-04-01 15:37:37 +02:00
Joe Friedl 2d0db67813 Fixed #20167 -- Preserve the traceback of `ImportError`s in `import_by_path`.
Thanks @carljm for the review.
2013-03-31 23:00:06 -04:00
Claude Paroz 3ff3212713 Fixed #19220 -- Prevented decimals to be displayed in scientific notation
Thanks nebstrebor for the report and antofik for the patch.
2013-03-31 22:39:01 +02:00
Baptiste Mispelon 5080311998 Fixed #20130 -- Regression in {% cache %} template tag. 2013-03-30 12:13:08 +01:00
Christoph Sieghart 465b01f065 Fixed #19998 -- Fixed --ignorenonexistent support for XML based fixtures. 2013-03-30 11:59:50 +01:00
Baptiste Mispelon a40746b1cb Fix #20158: invalid code in queryset_pickle test models. 2013-03-29 13:32:21 +01:00
Claude Paroz 86b1c31689 Fixed #19954 -- Fixed MySQL _last_executed decoding
Queries can contain binary data undecodable with utf-8. In this
case, using the 'replace' errors mode when decoding seems like
an acceptable representation of the query.
Thanks Marcel Ryser for the report.
2013-03-28 20:08:37 +01:00
Jacob Kaplan-Moss 4befef91f1 Correctly restore warning capture after logging tests.
This is a fix to the wrong behavior that 15c3906eeb introduced.
2013-03-27 17:01:11 -05:00
Jacob Kaplan-Moss 654d8e96ae Fixed logging-related test failure introduced by e79b857. 2013-03-27 12:05:31 -05:00
Jacob Kaplan-Moss f6989e559c Merge remote-tracking branch 'ptone/18985-fix' 2013-03-27 10:34:28 -05:00
Claude Paroz 34a50e99e8 Added regression test for custom SQL containing percents
Refs #3485.
2013-03-26 23:19:32 +01:00
Anssi Kääriäinen e17fa9e877 Fixed #20091 -- Oracle null promotion for empty strings 2013-03-26 14:19:54 +02:00
Adam Wentz a4b8a4b632 Fixed #20121 -- Removed LogEntry.get_admin_url's hard-coded path.
Updated LogEntry.get_admin_url to use 'reverse' instead
of a hard-coded path.
2013-03-25 23:45:27 -04:00
Claude Paroz 066bf42675 Removed forced typecasting of help_text/label Field arguments
In any case, setting those variables to non-ascii utf-8 bytestrings
is now considered a programming error.
2013-03-25 21:38:21 +01:00
Preston Holmes e79b857a07 Fixed #18985 -- ensure module level deprecations are displayed
Also don't compete with -W CLI option.

Thanks to Aymeric Augustin for the catch, and Claude Paroz for the patch.
2013-03-24 22:06:02 -07:00
Loic Bistuer 521765f63d Fixed #19541 -- Fixed BaseHandler to enable reversing URLs in response middlewares
and streamed responses with respect to per-request urlconf.
2013-03-25 03:19:19 +07:00
Anssi Kääriäinen 266de5f9ae Fixed 19385 -- Added ORM support for multicolumn joins
This patch iproved two major parts in Django. First, the fields.related
was refactored. The main addition there was ForeignObject. Second, the
ORM now handles multicolumn joins in most cases, though there are still
cases that do not work correcly (split_exclude() for example).

In addition there were extesive changes to how GenericRelation works.
Before it was a fake m2m field, now it is a pure virtual fields and is
based on ForeignObject.

There is still much room for improvement. The related fields code is
still somewhat confusing, and how fields are represented in model._meta
should also be revisited.

This patch was written mostly by Jeremy Tillman with some final polish
by the committer.
2013-03-24 18:08:01 +02:00
Aymeric Augustin bc35b95274 Fixed test failures introduced in e16c48e001. 2013-03-24 15:27:50 +01:00
Aymeric Augustin e16c48e001 Fixed #15124 -- Changed the default for BooleanField.
Thanks to the many contributors who updated and improved the patch over
the life of this ticket.
2013-03-24 13:47:01 +01:00
Claude Paroz 76aecfbc4b Fixed #9055 -- Standardized behaviour of parameter escaping in db cursors
Previously, depending on the database backend or the cursor type,
you'd need to double the percent signs in the query before passing
it to cursor.execute. Now cursor.execute consistently need percent
doubling whenever params argument is not None (placeholder substitution
will happen).
Thanks Thomas Güttler for the report and Walter Doekes for his work
on the patch.
2013-03-23 17:11:10 +01:00
Claude Paroz 164528acc8 Fixed #20108 -- Fixed filepath_to_uri decoding error
This was a regression due to unicode_literals usage. Thanks Ivan
Virabyan for the report and the initial patch.
2013-03-22 17:55:12 +01:00
Marc Tamlyn 829dc3c5a6 Fixed #20094 - Be more careful when checking for Iterator
Python 2.6 has some different behaviour when checking
isinstance(foo, collections.Iterator).
2013-03-22 17:31:29 +01:00
Andrew Gorcester f9ab543720 Fixed #20084 -- Provided option to validate formset max_num on server.
This is provided as a new "validate_max" formset_factory option defaulting to
False, since the non-validating behavior of max_num is longstanding, and there
is certainly code relying on it. (In fact, even the Django admin relies on it
for the case where there are more existing inlines than the given max_num). It
may be that at some point we want to deprecate validate_max=False and
eventually remove the option, but this commit takes no steps in that direction.

This also fixes the DoS-prevention absolute_max enforcement so that it causes a
form validation error rather than an IndexError, and ensures that absolute_max
is always 1000 more than max_num, to prevent surprising changes in behavior
with max_num close to absolute_max.

Lastly, this commit fixes the previous inconsistency between a regular formset
and a model formset in the precedence of max_num and initial data. Previously
in a regular formset, if the provided initial data was longer than max_num, it
was truncated; in a model formset, all initial forms would be displayed
regardless of max_num. Now regular formsets are the same as model formsets; all
initial forms are displayed, even if more than max_num. (But if validate_max is
True, submitting these forms will result in a "too many forms" validation
error!) This combination of behaviors was chosen to keep the max_num validation
simple and consistent, and avoid silent data loss due to truncation of initial
data.

Thanks to Preston for discussion of the design choices.
2013-03-21 01:27:24 -07:00
Carny Cheng aaec4f2bd8 Fixed #18839 - Field.__init__() now calls super(). 2013-03-20 16:20:57 -07:00
Matthew Wood a7960bcb35 Fixed #18972 -- Refactored bundled wsgi server's chunking algorithm.
Thanks to amosonn at yahoo.com for the report, @doda for the initial patch and
@datagrok for the revamped logic and test case.
2013-03-20 18:46:26 -04:00
Anssi Kääriäinen 80e68ee2ff Added tests for already fixed #20101
The ticket dealt with a case where one query had .exclude() that
produced a subquery, the other query had a join to the same model that
was subqueried in the first query. This was already fixed in master, so
only test added.
2013-03-21 00:43:26 +02:00
Claude Paroz 23490a2394 Revert "Fixed 19895 -- Made second iteration over invalid queryset raise an exception too"
This reverts commit 2cd0edaa47.
This commit was the cause of a memory leak. See ticket for more details.
Thanks Anssi Kääriäinen for identifying the source of the bug.
2013-03-20 10:41:53 +01:00
Paul Collins 9a85ad89c2 Fixed #16319 -- added SuccessMessageMixin to contrib.messages
Thanks martinogden for the initial patch and d1ffuz0r for tests.
2013-03-19 21:02:55 -07:00
Simon Charette 5938e7013e Fixed a python 3.2 syntax error and python 3 warning introduced by 054ce2aa02. 2013-03-19 22:16:48 -04:00
konarkmodi 483e1b807e Refs #18586 -- Split out long custom_columns lookup test into multiple tests. 2013-03-19 15:58:54 -07:00
Juan Catalano 054ce2aa02 Fixed #20088 -- Changed get_admin_log not to depend on User id field
Before this change, the get_admin_log method would expect User model's
FK to be named `id`. When changing that FK name, admin/index.html
rendering would fail.

This includes:
 * Changed the use of id for the use of pk property.
 * Added a regression test that fails without the patch.

This commit refs #20088.
2013-03-19 19:30:43 -03:00
Deric Crago 9d6ecc6bc6 Fixed #19327 -- Added handling of double login attempts in admin.
Thanks to Krzysztof Jurewicz for initial patch and
adupin for tests.
2013-03-18 17:11:07 -07:00
Aymeric Augustin 31b5275235 Fixed #13260 -- Quoted arguments interpolated in URLs in reverse. 2013-03-18 23:58:22 +01:00
Aymeric Augustin 9dc5702932 Fixed #19456 -- Avoid infinite recursion when tracing LazyObject.__init__.
Thanks blaze33 for the patch.
2013-03-18 11:22:43 +01:00
Aymeric Augustin 0efafa4c54 Fixed #18447 -- Made LazyObject unwrap on dict access.
Thanks Roman Gladkov and Zbigniew Siciarz.
2013-03-18 11:10:19 +01:00
Aymeric Augustin 20a91cce04 Fixed #17037 -- Added a --all option to diffsettings. 2013-03-18 00:03:58 +01:00
Anssi Kääriäinen 46f4b19920 Removed debug code 2013-03-17 11:31:15 +02:00
Baptiste Mispelon d5683bd06b Fix #20058: Make compilemessages use stdout instead of stderr. 2013-03-16 19:48:40 +01:00
Anssi Kääriäinen 2a2708e1b2 Fixed #17502 -- Made joining in inheritance cases consistent
The original problem was that when filtering two levels up in
inheritance chain, Django optimized the join generation so that the
middle model was skipped. But then Django generated joins from top
to middle to bottom for SELECT clause, and thus there was one extra
join (top->middle->bottom + top -> bottom).

This case is fixed in master as the filtering optimization is gone.
This has the side effect that in some cases there is still extra join
if the SELECT clause doesn't contain anything from middle or bottom.
2013-03-15 11:06:26 +02:00
Aymeric Augustin 3f2befc931 Deprecated django.views.defaults.shortcut. 2013-03-14 20:30:23 +01:00
Claude Paroz 2f121dfe63 Fixed #17051 -- Removed some 'invalid' field error messages
When the 'invalid' error message is set at field level, it masks
the error message raised by the validator, if any.
2013-03-14 17:03:43 +01:00
Claude Paroz 34d098665d Add a specific error message for URLValidator 2013-03-14 15:26:30 +01:00
Claude Paroz 9883551d50 Fixed #20039 -- Fixed has_changed form detection for required TypedChoiceFields
Thanks Florian Apolloner for the report and the review.
Also fixes #19643.
2013-03-14 14:49:07 +01:00
Anssi Kääriäinen 6b4834952d Fixed #16649 -- Refactored save_base logic
Model.save() will use UPDATE - if not updated - INSERT instead of
SELECT - if found UPDATE else INSERT. This should save a query when
updating, but will cost a little when inserting model with PK set.

Also fixed #17341 -- made sure .save() commits transactions only after
the whole model has been saved. This wasn't the case in model
inheritance situations.

The save_base implementation was refactored into multiple methods.
A typical chain for inherited save is:
save_base()
    _save_parents(self)
        for each parent:
            _save_parents(parent)
            _save_table(parent)
    _save_table(self)
2013-03-14 11:01:47 +02:00
Florian Apolloner 22b7870e40 Began implementing a shared set of test models to speed up tests. 2013-03-13 23:25:26 +01:00
Jacob Kaplan-Moss 1059da8de6 Merge pull request #900 from bmispelon/ticket-20022
Fix #20022: Correctly handle prefixes with url-unsafe characters in reverse()
2013-03-13 22:39:25 +01:00
Baptiste Mispelon 4fa7f3cdd9 Fix #20022: Correctly handle prefixes with url-unsafe characters in reverse(). 2013-03-13 18:19:29 +01:00
Aymeric Augustin 83a416f5e7 Made atomic usable when autocommit is off.
Thanks Anssi for haggling until I implemented this.

This change alleviates the need for atomic_if_autocommit. When
autocommit is disabled for a database, atomic will simply create and
release savepoints, and not commit anything. This honors the contract of
not doing any transaction management.

This change also makes the hack to allow using atomic within the legacy
transaction management redundant.

None of the above will work with SQLite, because of a flaw in the design
of the sqlite3 library. This is a known limitation that cannot be lifted
without unacceptable side effects eg. triggering arbitrary commits.
2013-03-13 15:17:40 +01:00
Anssi Kääriäinen bd0cba58aa Fixed failing aggregation tests on MySQL 2013-03-13 12:44:24 +02:00
Anssi Kääriäinen d3f00bd570 Refactored qs.add_q() and utils/tree.py
The sql/query.py add_q method did a lot of where/having tree hacking to
get complex queries to work correctly. The logic was refactored so that
it should be simpler to understand. The new logic should also produce
leaner WHERE conditions.

The changes cascade somewhat, as some other parts of Django (like
add_filter() and WhereNode) expect boolean trees in certain format or
they fail to work. So to fix the add_q() one must fix utils/tree.py,
some things in add_filter(), WhereNode and so on.

This commit also fixed add_filter to see negate clauses up the path.
A query like .exclude(Q(reversefk__in=a_list)) didn't work similarly to
.filter(~Q(reversefk__in=a_list)). The reason for this is that only
the immediate parent negate clauses were seen by add_filter, and thus a
tree like AND: (NOT AND: (AND: condition)) will not be handled
correctly, as there is one intermediary AND node in the tree. The
example tree is generated by .exclude(~Q(reversefk__in=a_list)).

Still, aggregation lost connectors in OR cases, and F() objects and
aggregates in same filter clause caused GROUP BY problems on some
databases.

Fixed #17600, fixed #13198, fixed #17025, fixed #17000, fixed #11293.
2013-03-13 10:44:49 +02:00
Anssi Kääriäinen d744c550d5 Fixed #19964 -- Removed relabel_aliases from some structs
Before there was need to have both .relabel_aliases() and .clone() for
many structs. Now there is only relabeled_clone() for those structs
where alias is the only mutable attribute.
2013-03-12 21:33:47 +02:00
Aymeric Augustin 885d98d24a Fixed #20028 -- Made atomic usable on callable instances.
Thanks Anssi for the report.
2013-03-12 10:52:16 +01:00
Aymeric Augustin f8a634afa2 Fixed tests that relied on MANAGERS not being empty.
Regression in d0561242.
2013-03-11 23:30:02 +01:00
Jacob Kaplan-Moss d056124269 Remove a special case for comment tests from runtests.py. 2013-03-11 15:38:53 -05:00
Aymeric Augustin b746f8a9e3 Adjusted query counts to account for new savepoints. 2013-03-11 21:07:19 +01:00
Aymeric Augustin 55a9be8ecf Ran a test that closes the database connection outside of a transaction. 2013-03-11 19:42:59 +01:00
Claude Paroz 9b74a8391d Removed forced settings in runtests
Tests that require USE_I18N, LOGIN_URL or certain MIDDLEWARE_CLASSES
should be decorated appropriately.
2013-03-11 17:46:56 +01:00
Aymeric Augustin e654180ce2 Improved the API of set_autocommit. 2013-03-11 15:10:58 +01:00
Aymeric Augustin 86fd920f67 Removed a test that no longer makes any sense.
Since unmanaged == autocommit, there's nothing to commit or roll back.
2013-03-11 15:05:04 +01:00
Aymeric Augustin 0cee3c0e43 Updated a test that doesn't make sense with autocommit. 2013-03-11 15:05:04 +01:00
Aymeric Augustin 107d9b1d97 Added an option to disable the creation of savepoints in atomic. 2013-03-11 15:05:04 +01:00
Aymeric Augustin ac37ed21b3 Deprecated TransactionMiddleware and TRANSACTIONS_MANAGED.
Replaced them with per-database options, for proper multi-db support.

Also toned down the recommendation to tie transactions to HTTP requests.
Thanks Jeremy for sharing his experience.
2013-03-11 15:04:05 +01:00
Aymeric Augustin 7c46c8d5f2 Added some assertions to enforce the atomicity of atomic. 2013-03-11 14:48:55 +01:00
Aymeric Augustin d7bc4fbc94 Implemented an 'atomic' decorator and context manager.
Currently it only works in autocommit mode.

Based on @xact by Christophe Pettus.
2013-03-11 14:48:55 +01:00
Aymeric Augustin 4b31a6a9e6 Added support for savepoints in SQLite.
Technically speaking they aren't usable yet.
2013-03-11 14:48:55 +01:00
Aymeric Augustin 3bdc7a6a70 Deprecated transaction.is_managed().
It's synchronized with the autocommit flag.
2013-03-11 14:48:54 +01:00
Aymeric Augustin ba5138b1c0 Deprecated transaction.commit/rollback_unless_managed.
Since "unless managed" now means "if database-level autocommit",
committing or rolling back doesn't have any effect.

Restored transactional integrity in a few places that relied on
automatically-started transactions with a transitory API.
2013-03-11 14:48:54 +01:00
Aymeric Augustin af9e9386eb Enabled autocommit for PostgreSQL.
For users who didn't activate autocommit in their database options, this
is backwards-incompatible in "non-managed" aka "auto" transaction state.
This state now uses database-level autocommit instead of ORM-level
autocommit.

Also removed the uses_autocommit feature which lost its purpose.
2013-03-11 14:48:54 +01:00
Aymeric Augustin 8717b0668c Separated autocommit and isolation level handling for PostgreSQL.
Autocommit cannot be manipulated independently from an open connection.
This commit introduces a minor change in behavior: entering transaction
management forces opening a databasse connection. This shouldn't be
backwards incompatible in any practical use case.
2013-03-11 14:48:54 +01:00
Aymeric Augustin 7aacde84f2 Made transaction.managed a no-op and deprecated it.
enter_transaction_management() was nearly always followed by managed().

In three places it wasn't, but they will all be refactored eventually.
The "forced" keyword argument avoids introducing behavior changes until
then.

This is mostly backwards-compatible, except, of course, for managed
itself. There's a minor difference in _enter_transaction_management:
the top self.transaction_state now contains the new 'managed' state
rather than the previous one. Django doesn't access
self.transaction_state in _enter_transaction_management.
2013-03-11 14:48:53 +01:00
Aymeric Augustin ce76fbfc5a Fixed #20019 -- Ensured HttpRequest.resolver_match always exists.
Obviously it isn't set until the URL is resolved.
2013-03-10 23:28:19 +01:00
Ramiro Morales 7fca4416c7 Made (make|compile)messages check for availability of gettext commands.
Refs #19584.
2013-03-10 17:31:11 -03:00
Claude Paroz 6a91b63842 Fixed #19923 -- Display tracebacks for non-CommandError exceptions
By default, show tracebacks for management command errors when the
exception is not a CommandError.
Thanks Jacob Radford for the report.
2013-03-09 12:38:45 +01:00
Claude Paroz cbfb8ed53b Fixed a regression in forms changed_data
Thanks Loic Bistuer for spotting the regression and the initial
patch. Refs #16612.
2013-03-08 18:19:24 +01:00
Loic Bistuer 6983a1a540 Fixed #15363 -- Renamed and normalized to `get_queryset` the methods that return a QuerySet. 2013-03-08 10:11:45 -05:00
Aymeric Augustin 477d737e1e Merge pull request #850 from bmispelon/ticket-19916
Fix 19916. Smarter tokenizing of contrib.comment's templatetags arguments
2013-03-07 12:12:29 -08:00
Alex Gaynor bbbd698c7a Added a ManyToManyField(db_constraint=False) option, this allows not creating constraints on the intermediary models. 2013-03-07 11:24:51 -08:00
Baptiste Mispelon 81804ae474 Fix 19916. Smarter tokenizing of contrib.comment's templatetags arguments. 2013-03-07 19:30:38 +01:00
Claude Paroz 4cccb85e29 Fixed #19997 -- Added custom EMPTY_VALUES to form fields
Thanks Loic Bistuer for the report and the patch.
2013-03-07 15:22:03 +01:00
Igor Támara e2ee02c5bd Fixed #19951 -- Admin: Invalid model PK values shouldn't cause 500 status.
Avoid ValueError in admin when passing a string as PK for an inherited
model with an integer PK field.

Thanks ikks for the patch. See also #11191.
2013-03-06 21:38:44 -03:00
Ramiro Morales c31a9793c6 Merge pull request #882 from loic/testfix
Fixed minor warnings in tests.
2013-03-06 16:22:06 -08:00
Preston Holmes 876fc39128 PEP8 cleanup of functional.py 2013-03-06 16:14:46 -08:00
Preston Holmes 0ea5bf88dd Fixed #19543 -- implemented SimpleLazyObject.__repr__
Thanks to Florian Hahn for the patch
2013-03-06 16:13:12 -08:00
Aymeric Augustin b3aa853ec5 Used more precise test assertions. 2013-03-06 15:33:35 +01:00
Loic Bistuer 9ba0e4e4ee Fixed minor warnings in tests. 2013-03-06 01:13:36 +07:00
Juan Pedro Fisanotti d9330d5be2 Fixed #6585 -- Admin relationship widgets: Respect ordering defined by target model's ModelAdmin.
Thanks Gary Wilson for the report and Juan Pedro Fisanotti, Carlos
Matías de la Torre for the fix.
2013-03-04 18:08:53 -03:00
Javier Mansilla 3ea0c7d35a Fixed #19838 -- Admin: Don't leak a 500 HTTP status when trying to delete protected FKs.
Thanks rafadev for the report and Javier Mansilla for the fix.
2013-03-04 13:30:59 -03:00
Ramiro Morales 60dd4eabe7 Removed mentions of modeltests. 2013-03-03 18:44:06 -03:00
matiasb 804366327d Fixed #19915 - Made blocktrans tag honor TEMPLATE_STRING_IF_INVALID.
Thanks Natalia Bidart for the report and Matías Bordese for the fix.
2013-03-03 16:10:11 -03:00
Claude Paroz 384c180e41 Fixed #19917 -- Added microseconds in default TIME_INPUT_FORMATS
Thanks minddust for the report.
2013-03-02 18:11:10 +01:00
Aymeric Augustin e0449316eb Fixed #18130 -- Made the isolation level configurable on PostgreSQL.
Thanks limscoder for the report and niwi for the draft patch.
2013-03-02 15:05:49 +01:00
Claude Paroz c5a25c2771 Add introspection support for BinaryField 2013-03-02 10:29:03 +01:00
Claude Paroz d680a3f447 Added support for serializing BinaryField 2013-03-02 10:29:02 +01:00
Claude Paroz 8ee1eddb7e Add a BinaryField model field
Thanks Michael Jung, Charl Botha and Florian Apolloner for review
and help on the patch.
2013-03-02 10:29:02 +01:00
Simon Charette 0f306cad84 Import `CaptureQueriesContext` from its original module. 2013-03-02 03:45:42 -05:00
Simon Charette fb3d85bd14 Fixed #10399 -- Tested that o2o field updates are not constrained by an inner query. 2013-03-02 03:24:08 -05:00
Simon Charette 952ba5237e Added a context manager to capture queries while testing.
Also made some import cleanups while I was there.

Refs #10399.
2013-03-02 02:41:14 -05:00
Claude Paroz 3318595c0b Fixed #18898 -- Added tests with a fix for ModelMultipleChoiceField 2013-03-01 09:35:18 +01:00
Claude Paroz 892bc91cb0 Fixed #16612 -- Improved has_changed detection for localized field values
Thanks Simon Charette for the review.
2013-03-01 09:35:04 +01:00
Aymeric Augustin cf30469164 Fixed tests broken in 2ee21d9. 2013-02-28 17:08:16 +01:00
Aymeric Augustin 2ee21d9f0d Implemented persistent database connections.
Thanks Anssi Kääriäinen and Karen Tracey for their inputs.
2013-02-28 15:28:13 +01:00
Aymeric Augustin aa089b106b Fixed #5241 -- Kept active transalation in LocaleMiddleware.process_response. 2013-02-28 14:21:48 +01:00
Anssi Kääriäinen 06de130dae Fixed #12823 -- Was already fixed in master, tests added
Also added a little improvement to sql/query.py to get rid of
non-necessary IS NOT NULL check.
2013-02-28 15:05:48 +02:00
Łukasz Langa af3321a1e8 use the real path to fix OS X /var/folders vs. /private/var/folders mismatch 2013-02-27 23:33:47 +01:00
Anssi Kääriäinen 21189cb80b Made dateformat tests reactivate original language 2013-02-27 23:48:17 +02:00
Aymeric Augustin 7aaa8a7779 Fixed a test that relied on database exceptions not being wrapped. 2013-02-27 21:12:48 +01:00
Aymeric Augustin b2c697b029 Fixed a PendingDeprecationWarning in template_tests. 2013-02-27 21:09:27 +01:00
Anssi Kääriäinen 50328f0a61 Fixed #19861 -- Transaction ._dirty flag improvement
There were a couple of errors in ._dirty flag handling:
  * It started as None, but was never reset to None.
  * The _dirty flag was sometimes used to indicate if the connection
    was inside transaction management, but this was not done
    consistently. This also meant the flag had three separate values.
  * The None value had a special meaning, causing for example inability
    to commit() on new connection unless enter/leave tx management was
    done.
  * The _dirty was tracking "connection in transaction" state, but only
    in managed transactions.
  * Some tests never reset the transaction state of the used connection.
  * And some additional less important changes.

This commit has some potential for regressions, but as the above list
shows, the current situation isn't perfect either.
2013-02-27 17:54:27 +02:00
Łukasz Langa 40b9f4fb8b [py3] Always fed hashlib with bytes. 2013-02-27 10:02:07 +01:00
Ramiro Morales a28e2e7c4d Removed a .mo file incorrectly put under Git control. 2013-02-26 22:45:08 -03:00
Ramiro Morales f0bd553922 Simplified compilemessages tests a bit. 2013-02-26 22:30:49 -03:00
Ramiro Morales dfa9324966 Don't use os.system() in compilemessages.
Fixes #19584.

This implies stop storing file path command line arguments in envvars as
a security measure to start relying on with Popen's shell=False instead,
and addition of an 'utils' module.

Thanks kmichel_wgs for the report.
2013-02-26 21:31:53 -03:00
Claude Paroz 58a2fc820e Fixed i18n test to match changed translation
Forward port of ab6ff2e0ac from stable/1.5
2013-02-26 21:51:06 +01:00
Florian Apolloner 33234aa8f7 Fixed discovery of the Django installation during tests.
If Django was symlinked into site-packages the previous approach to discover
the tests subdirectory would fail. The revised version now always points to
the location of the source and not the import path.
2013-02-26 21:04:32 +01:00
Florian Apolloner 0fe11fca40 Changed test_runner tests to use full python path for settings files. 2013-02-26 16:02:24 +01:00
Florian Apolloner 1535fcfdba fixed admin_scripts tests on python 3.3 2013-02-26 15:38:11 +01:00
Florian Apolloner 0dc7ff6b7a Ensured that we have an absolute path to RUNTESTS_DIR.
This is needed to make 'python runtests.py' work, otherwise only
'python ./runtests.py' would work.
2013-02-26 15:20:37 +01:00
Florian Apolloner 4d9f39f307 Renamed a template to be found by the loaders. 2013-02-26 14:36:58 +01:00
Florian Apolloner 33836cf88d Renamed some tests and removed references to modeltests/regressiontests. 2013-02-26 14:36:57 +01:00
Florian Apolloner 737a5d71f0 Adjusted coveragerc 2013-02-26 14:36:57 +01:00
Florian Apolloner fc074db29c Adjusted runtests to the new layout. 2013-02-26 14:36:57 +01:00
Florian Apolloner 89f40e3624 Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00
Florian Apolloner b3d2ccb5bf Removed __init__.py files. 2013-02-26 14:36:57 +01:00
Florian Apolloner 41d7a9a907 Moved test_templates to templates to prevent issues with regressiontests/templates later on. 2013-02-26 14:36:57 +01:00
Aymeric Augustin 8dd8400f7e Updated an inaccurate comment.
Tests can run nearly as fast under PostgreSQL and MySQL as under SQLite
with a bit of configuration and the speedup is always a good thing.
2013-02-26 10:00:14 +01:00
Carl Meyer 6a8f95d812 Fixed a caching test on Python 3. 2013-02-25 18:12:55 -07:00
Łukasz Langa 6a057e1595 Fixed #18191 -- Don't consider Accept-Language redundantly in cache key.
Thanks to choongmin for the original patch.
2013-02-25 16:10:57 -07:00
Aymeric Augustin e76147a83a Fixed #19634 -- Added proper __hash__ methods.
Classes overriding __eq__ need a __hash__ such that equal objects have
the same hash.

Thanks akaariai for the report and regebro for the patch.
2013-02-25 23:05:20 +01:00
Carl Meyer 509798ae06 Use built-in fixture support rather than calling loaddata in setUp(). 2013-02-25 12:13:10 -07:00
Aymeric Augustin 86b96038f2 Merge pull request #847 from fhahn/ticket_18176
Fixed #18176 -- Added test for year lookups with year < 1000
2013-02-25 09:26:56 -08:00
Carl Meyer 906dc8522a Fixed #19854 -- Turn Django's own Selenium tests off by default. 2013-02-25 10:14:42 -07:00
Florian Hahn f28c301a47 Fixed #18176 -- Added test for year lookups with year < 1000
Thanks Tomas Ehrlich for the initial test
2013-02-25 17:13:27 +01:00
Claude Paroz 6d52bcbb7c Fixed #19903 -- Fixed unbalanced setUp/tearDown calls in LiveServerAddress test 2013-02-25 08:58:11 +01:00
Aymeric Augustin 7b49da1c38 Changed testing strategy used in 6b03179e.
Avoid polluting the app cache as it causes unrelated test failures.

Refs #19688.
2013-02-25 00:09:13 +01:00
Julien Phalip ae2a8bb456 Fixed a test that was failing in Python 3.
The issue was that as of Python 3, the generators' `next()`
method becomes `__next()`. Thanks Alex Gaynor for noticing that.
Refs #19890.
2013-02-24 13:47:14 -08:00
Julien Phalip a8449d4362 Merge pull request #824 from ambv/languagecode 2013-02-24 12:56:14 -08:00
Simon Charette 6b03179e12 Fixed #19688 -- Allow model subclassing with a custom metaclass using six.with_metaclass 2013-02-24 17:32:34 +01:00
Christopher Medrela 636c45fc58 Fixed #19890 -- ifchanged templatetag rendered its content twice
The content of ifchanged template tag was rendered twice: first time, to
compare it with the previous value and the second time, to return the
rendered output.
2013-02-24 16:49:28 +01:00
Diederik van der Boor 8503120c10 Fixed #15849 -- Made IfChanged node thread safe.
Previously, the ifchanged node stored state on `self._last_seen`,
thereby giving undesired results when the node is reused by another
thread at the same time (e.g. globally caching a Template object).

Thanks to akaihola for the report and Diederik van der Boor and
Bas Peschier for the patch.
2013-02-24 16:06:55 +01:00
Zbigniew Siciarz 0a8402eb05 Test case and docs for custom context data in feeds
Thanks Paul Winkler for the initial patch. (Ref #18112).
2013-02-24 08:33:20 -06:00
Florian Apolloner 4506ae0497 Merge pull request #717 from slurms/ticket_19746
Fixed #19746 -- Allow deserialization of pk-less data
2013-02-24 06:31:14 -08:00
Łukasz Langa 8c8f94fe9d Fixes #19763 - LocaleMiddleware should check for supported languages in settings.LANGUAGE_CODE 2013-02-24 14:43:45 +01:00
Tomek Paczkowski 99edbe0e27 Fixed #19253 -- Extracted template cache key building logic
Introduced a public function
django.core.cache.utils.make_template_fragment_key
Thanks @chrismedrela for fruitful cooperation.
2013-02-24 14:32:45 +01:00
Aymeric Augustin 7106a1e594 Merge pull request #819 from erikr/master
Fixed #16302 -- Ensured contrib.comments is IPv6 capable.
2013-02-24 05:02:00 -08:00
Erik Romijn ade992c61e Fixed #16302 -- Ensure contrib.comments is IPv6 capable
Changed the ip_address field for Comment to GenericIPAddressField. Added
instructions to the release notes on how to update the schema of existing
databases.
2013-02-24 13:58:38 +01:00
Bas Peschier 5a9b2bce24 Fixed #19810 -- MemcachedCache now uses pickle.HIGHEST_PROTOCOL 2013-02-24 13:56:15 +01:00
Wiktor Kolodziej f07a5f0a21 Fixed #11295: If ModelAdmin.queryset returns a filtered QS don't require a 2nd count call
Original patch rewritten, added tests and get_filters_params method for ChangeList class.
Thanks Alex for the report.
2013-02-24 13:23:23 +01:00
Florian Apolloner e4ee3d8fca Fixed a few ResourceWarnings. 2013-02-24 13:11:19 +01:00
Honza Král e4e1287590 Merge pull request #817 from rybaktomasz/ticket_5568
Fixes #5568 -- DROP INDEX subcommand
2013-02-24 04:02:26 -08:00
Honza Kral cbb9f629b8 Revert "fixes #19263" - Fails if not SQLite
This reverts commit 2b76f19f2b.
2013-02-24 12:38:32 +01:00
Tomasz Rybak d7429defe6 Add sqldropindexes to manage
Change patch from https://code.djangoproject.com/ticket/5568
to work on modern Django.
Add special case for MySQL which has different syntax for DROP INDEX.
Add unit tests for the new functionality.
2013-02-24 12:38:28 +01:00
Honza Kral 5a6a4249f3 Removing unneeded tearDown code. 2013-02-24 12:31:00 +01:00
George Song 44164c5c30 Fixed #19896 -- Committed after clearing cache in the database. 2013-02-24 12:15:02 +01:00
Florian Apolloner f56ca3f0e6 Fixed the usage of the deprecated assertEquals. 2013-02-24 11:15:17 +01:00
Aymeric Augustin c10ed58746 Caught warnings in the templates tests. Refs #17906.
This was missing from f49e9a517f.
2013-02-24 10:28:05 +01:00
Honza Král fc38d6a92b Merge pull request #813 from HiddenData/ticket-19263
fixes #19263 - EmptyResultSet in subquery causes incorrect SQL
2013-02-23 15:05:24 -08:00
Marcin Biernat 2b76f19f2b fixes #19263 2013-02-23 23:53:46 +01:00
Honza Král 692902b227 Merge pull request #778 from viciu/19609
Fixed #19609: admin Inlines doesn't display help_text for readonly fields
2013-02-23 14:34:57 -08:00
Honza Kral ef1e6ef1eb Merge branch 'ticket19872' of https://github.com/oinopion/django 2013-02-23 23:32:09 +01:00
Honza Kral 2b48fcc607 Fixed #18491 -- deleting a proxy doesn't show warning about cascade deletes 2013-02-23 23:20:34 +01:00
Tomek Paczkowski b88abd6840 Fixed #19872
Made cached_property to behave as property when accessed via class.
2013-02-23 23:20:00 +01:00
Aleksandra Sendecka 32a7ab2148 Fixed #19526
CSS specifications governs that syntax is case insensitive.
This modifies CachedFilesMixin to support that.
2013-02-23 23:05:22 +01:00
Klaas van Schelven 1c11ee6345 Fixed #18829 -- Fixed ModelChoiceIterator length
Thanks facundo.olano at gmail.com for the report and thikonom for
the initial patch.
2013-02-23 22:27:07 +01:00
Alex Gaynor 150e202172 Some style fixes for stuff that was clearly brough tover from doctests. 2013-02-23 13:04:08 -08:00
Honza Král 10026c2ad0 Merge pull request #804 from oinopion/ticket18162
Fixes #18162 --  Specifying choices to Field overrides any form_class argument
2013-02-23 12:45:39 -08:00
Grzegorz Nosek 2cd0edaa47 Fixed 19895 -- Made second iteration over invalid queryset raise an exception too
When iteration over a queryset raised an exception, the result cache
remained initialized with an empty list, so subsequent iterations returned
an empty list instead of raising an exception
2013-02-23 14:35:27 -06:00
Łukasz Langa 539900f117 Fixes #17866: Vary: Accept-Language header when language prefix used 2013-02-23 19:41:33 +01:00
Honza Kral bfd4a71d41 One last final fix for 0ad76843. Tested on py3 and py2 2013-02-23 19:27:37 +01:00
Honza Král 0a341ab40d Merge pull request #791 from khalas/ticket_19811
Changed %r to %s in get_language_info error message
2013-02-23 10:16:23 -08:00
Tomek Paczkowski b6f4a92ff4 Proposed fix for #18162. 2013-02-23 19:01:38 +01:00
Konrad Hałas 48dc0cbf2a Changed %r to %s in get_language_info error message. 2013-02-23 18:54:54 +01:00
Florian Apolloner f368c25f10 Fixed errors introduced in 664855b74e 2013-02-23 18:47:36 +01:00
Florian Apolloner 5ae0c933a8 Fixed errors introduced in 21f333bcef. Refs #17751 2013-02-23 18:43:34 +01:00
Claude Paroz cc53d9b30b Fixed #15877 -- Improved exception when ModelForm has no model class
Thanks theaspect at gmail.com for the report and volrath for the
patch.
2013-02-23 18:32:29 +01:00
Wiktor Kolodziej 67dd54dc84 Fixed #19609: admin Inlines doesn't display help_text for readonly fields
Refactoring: field was renamed to field_name, since flatten_fieldsets returns field name, not field.

Original patch from Marc Aymerich Gubern
2013-02-23 18:24:32 +01:00
Honza Král a05ab448f7 Merge pull request #781 from zsiciarz/ticket_19854
Fixed #19854 -- Added test runner option to skip Selenium tests
2013-02-23 08:55:34 -08:00
Zbigniew Siciarz 1cd2f51eb4 Added test runner option to skip Selenium tests (#19854). 2013-02-23 17:45:26 +01:00
Claude Paroz 335a060fa6 Minor cleanups in templates test imports 2013-02-23 17:45:05 +01:00
Lennart Regebro 687d2e967d Fixed #19827 -- Kept stacktrace in defaulttags exception reraising
Thanks Kronuz for the report and the initial patch.
2013-02-23 17:43:17 +01:00
Honza Král 0ad76843b5 Merge pull request #777 from khalas/ticket_19811
Fixed #19811 - Added language code fallback in get_language_info
2013-02-23 08:30:27 -08:00