Commit Graph

12536 Commits

Author SHA1 Message Date
Alex Gaynor a351e383b6 There's no need to do `list(dict.keys())` list(dict)` is enough. 2012-08-14 06:57:16 -07:00
Anssi Kääriäinen 4e7f04cdad [py3] Fixed file.read().decode(), used codecs.open() instead 2012-08-14 16:09:01 +03:00
Anssi Kääriäinen 62a9ed0ac7 [py3] Fixed F-expression division operators
In Python 3 dividing by int will call obj.__truediv__(). This operator
was missing from F-expressions.
2012-08-14 16:07:32 +03:00
Claude Paroz c2d59e5564 [py3] Fixed admin_views tests
Also changed several occurrences of 'request' to 'response'.
2012-08-14 14:45:28 +02:00
Aymeric Augustin d6b8b125fb [py3] Fixed admin_custom_urls tests. 2012-08-14 14:38:23 +02:00
Aymeric Augustin 0c198b85a3 [py3] Replace filter/lambda by list comprehensions
This is more idiomatic and avoids returning a list on Python 2 and
an iterator on Python 3.
2012-08-14 14:31:06 +02:00
Anssi Kääriäinen 5b27e6f64b [py3] Fixed comparison of list and range()
A test compared list directly against a range(). This is py3
incompatible. Fixed by using list(range()).
2012-08-14 15:28:55 +03:00
Anssi Kääriäinen 8fe03865f7 [py3] Fixed invalid use of dict.items()
An ordering test had two problems related to dict.items() usage:
  - It assumed the order of the dict was non-randomized
  - It indexed to the dict.items() which is py3 incompatible.

I fixed the test by using dict['rank'] directly, where rank is the
column tested on the values queryset.
2012-08-14 15:24:43 +03:00
Aymeric Augustin 9299dc42ed [py3] Removed unnecessary calls to .keys()
when computing the length of a dictionary. This fails on Python 3.
2012-08-14 14:09:23 +02:00
Aymeric Augustin 2ae58b20ec [py3] Fixed egg template loader. 2012-08-14 12:29:53 +02:00
Aymeric Augustin dcf72835e3 [py3] Ensured the template tests run. 2012-08-14 12:29:53 +02:00
Aymeric Augustin faf570df18 [py3] Compared response.content with bytes. 2012-08-14 12:29:53 +02:00
Claude Paroz d1452f6097 [py3] Favoured unicode strings in assert(Not)Contains
In Python 3, HTMLParser does not support bytestrings.
2012-08-14 12:19:17 +02:00
Aymeric Augustin e04230e2e4 [py3] Ported django.http according to PEP 3333.
Perfomed some style cleanup while I was in the area.
2012-08-14 10:32:16 +02:00
Claude Paroz 0df0cf70d4 Reverted pickle-json replacement form_hmac calculation
This reverts commit b109ff8062 and
complement test cases. The change was too hasty, as some form
values cannot be json-serialized as is.
2012-08-14 09:51:39 +02:00
Claude Paroz 363dbd920e [py3] Fixed contrib.formtools tests 2012-08-13 21:26:12 +02:00
Claude Paroz a025b75f6c [py3] Fixed iterlists usage in QueryDict 2012-08-13 21:25:27 +02:00
Claude Paroz b109ff8062 Replaced pickle by json in form_hmac calculation
Refs #18340
2012-08-13 21:02:18 +02:00
Claude Paroz 0dac73ebd7 Removed binary flag to open files for writing text content 2012-08-13 18:23:26 +02:00
Florian Apolloner d2975718fe Consistenly use _ as alias for ugettext_lazy in the i18n docs. 2012-08-13 16:54:13 +02:00
Claude Paroz 45baaabafb [py3] Fixed encoding issues in cache key generation 2012-08-13 12:56:59 +02:00
Claude Paroz d774ad752d [py3] Made csrf context processor return Unicode 2012-08-13 11:54:21 +02:00
Claude Paroz 5e958b958b [py3] Avoided comparison with None value in formsets 2012-08-13 11:54:13 +02:00
Claude Paroz 73f0f18c8f [py3] Fixed admin_scripts tests 2012-08-13 10:58:21 +02:00
Claude Paroz a06503d09b [py3] Fixed content encoding in test client
Thanks Andrews Medina for the initial patch.
2012-08-13 09:56:14 +02:00
Claude Paroz 6d68022a27 [py3] Removed filename encoding in file_uploads test 2012-08-13 09:56:14 +02:00
Anssi Kääriäinen 1930b899bd Refix #13844 -- Made FloatField aggregates work on Python 2.6 + Postgres
Fixed a regression introduced in 59a655988e.
2012-08-13 09:15:20 +03:00
Claude Paroz 8a1f439d3a [py3] Fix encoding issues in contrib.sessions 2012-08-12 22:49:10 +02:00
Claude Paroz ac37c9e495 [py3] Encoded value before feeding it to hashlib.md5 2012-08-12 22:49:10 +02:00
Andrei Antoukh 99321e30ce Fixed #18306 -- Made deferred models issue update_fields on save
Deferred models now automatically update only the fields which are
loaded from the db (with .only() or .defer()). In addition, any field
set manually after the load is updated on save.
2012-08-12 22:39:27 +03:00
Anssi Kääriäinen 59a655988e Fixed #13844 -- Avoid converting unknown db values to float
This patch removes an unconditional float(value) conversion from db
backend default convert_values() method. This can cause problems when
aggregating over character fields for example. In addition, Oracle
and SQLite already return the bare value from their convert_values().

In the long term the converting should be done by fields, and the
fields should then call database backend specific converters when
needed. The current setup is inflexible for 3rd party fields.

Thanks to Merlijn van Deen for the original patch.
2012-08-12 21:52:52 +03:00
Claude Paroz 5513480fe1 [py3] Always convert values from sqlite3 to unicode strings
Thanks Aymeric Augustin for the review.
2012-08-12 20:47:18 +02:00
Claude Paroz dce34dc969 [py3] Made __repr__ return str with Python 3 2012-08-12 20:45:39 +02:00
Anssi Kääriäinen c1684e3dcb Fixed #18731 -- Cleaned up split_exclude's use of can_reuse
The outer query's set of reusable joins (can_reuse) was passed to the
inner query's add_filter call. This was incorrect.
2012-08-12 21:40:22 +03:00
Karen Tracey 49bb72c403 [py3] Made exception examination py3-compatible. 2012-08-12 12:08:58 -04:00
Aymeric Augustin 031896c510 [py3] Explained @python_2_unicode_compatible usage 2012-08-12 15:22:33 +02:00
Aymeric Augustin 4e68e86153 [py3] Deprecated StrAndUnicode.
This mix-in is superseded by the @python_2_unicode_compatible decorator.
2012-08-12 14:44:41 +02:00
Aymeric Augustin d4a0b27838 [py3] Refactored __unicode__ to __str__.
* Renamed the __unicode__ methods
* Applied the python_2_unicode_compatible decorator
* Removed the StrAndUnicode mix-in that is superseded by
  python_2_unicode_compatible
* Kept the __unicode__ methods in classes that specifically
  test it under Python 2
2012-08-12 14:44:40 +02:00
Aymeric Augustin 79d62a7175 [py3] Added fixer for python_2_unicode_compatible.
This doesn't deal with classes that define both __unicode__ and
__str__; the definition of __str__ should be removed first. It
doesn't guarantee that __str__ will return a str (rather than bytes)
under Python 3 either.
2012-08-12 14:44:40 +02:00
Aymeric Augustin a0a0203a39 [py3] Added python_2_unicode_compatible decorator. 2012-08-12 14:44:40 +02:00
Aymeric Augustin e7e08fd48b [py3] Replaced some __str__ methods by __unicode__
These methods actually return unicode.
2012-08-12 14:44:40 +02:00
Aymeric Augustin 2bb2eecb63 [py3] Removed redundant __str__ methods.
These classes already have an identical __unicode__ method, which
will be used after an upcoming refactoring.
2012-08-12 14:44:40 +02:00
Aymeric Augustin dbb63e56ea [py3] Avoided returning bytes in Model.__str__
on Python 3.
2012-08-12 14:44:40 +02:00
Florian Apolloner 9e7b5ba50f Removed missplaced label in the docs. 2012-08-12 12:43:05 +02:00
Martijn Vermaat 140179c770 Fix link to Gunicorn website in deployment howto. 2012-08-12 12:37:55 +02:00
Karen Tracey 759ae3c2da Fixed #18739 -- witdthratio behavior on None args
Made behavior given None consistent with how non-numerics were handled.
Thanks to ja.geb@me.com for the report.
2012-08-11 19:24:18 -04:00
Claude Paroz 15fffcc751 [py3] Fixed reraising of exceptions
reraise with second argument to None is not supported.
2012-08-11 23:46:23 +02:00
Karen Tracey be7f1099c6 Decorated some tests that require tz support.
This allows the test suite to run without errors on Windows.
2012-08-11 17:32:24 -04:00
Claude Paroz 900816464d [py3] Re-decoded string after idna encoding 2012-08-11 23:23:31 +02:00
Claude Paroz 6602103338 [py3] Various minor syntax fixes in the test suite 2012-08-11 23:23:31 +02:00