Commit Graph

636 Commits

Author SHA1 Message Date
Malcolm Tredinnick 2e62b84acc Fixed #6071 -- Fixed another infinite recursion problem in SafeString and
SafeUnicode. Thanks, Trey Long.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6845 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-02 20:17:10 +00:00
Malcolm Tredinnick 51dc4ecf94 Fixed #6042 -- ModelForms implementation from Joseph Kocherhans. Still might
need a little tweaking as people start to use it, but this is mostly complete.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6844 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-02 19:29:54 +00:00
Malcolm Tredinnick 61947f0635 Fixed #3961 -- Added South African localflavor. Thanks, Russell Cloran.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6843 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-02 18:43:01 +00:00
Malcolm Tredinnick 805c364fcf Fixed #3511 -- Changed QuerySet.get() to return a MultipleObjectsReturned exception, rather than an assertion error. Thanks, Gary Wilson and cheeming.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6838 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-02 18:21:07 +00:00
Malcolm Tredinnick 5e5768ae83 Fixed #3323 -- More robust error handling for related objetcs. Thanks, Greg
Kopka and shaleh.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6835 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-02 18:10:07 +00:00
Gary Wilson Jr 892b04bf21 Fixed a use of `maxlength`, refs #2101.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6824 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-02 01:45:59 +00:00
Gary Wilson Jr 075cfa72ba Removed unused import.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6823 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-02 01:44:58 +00:00
Malcolm Tredinnick f6a3b499b8 Fixed #6086 -- Deprecate the "simple" cache backend in favour of "locmem".
Thanks, Paul Bissex.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6822 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-02 00:35:14 +00:00
Malcolm Tredinnick 348f2cbfc1 Fixed #5996 -- Add a pyscopg2 convertor for SafeUnicode -> unicode. Thanks, remco@diji.biz
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6816 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-01 22:26:24 +00:00
Malcolm Tredinnick b3db18817a Fixed #5979 -- Always use SITE_ID=1 when running Django's core tests. This
makes things much easier. Thanks, George Vilches.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6814 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-01 21:58:51 +00:00
Malcolm Tredinnick a72324bf7f Fixed #6068 -- Updated docstrings in model tests to make the documentation
examples correct.  Thanks Wang Chun.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6813 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-01 21:18:45 +00:00
Malcolm Tredinnick 8de4ed9c8c Fixed #6057 -- Mark rendered template output as safe for auto-escaping purposes.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6778 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-30 15:32:01 +00:00
Malcolm Tredinnick 5d1d054e15 Fixed #6030 -- More robust error handling for the "float" filter. Thanks,
SmileyChris.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6752 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-29 20:10:00 +00:00
Malcolm Tredinnick caa0523cb8 Fixed #6050 -- Handled edge-case of duplicate keys being passed when
initialising SortedDict. Patch from Collin Grady and SmileyChris.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6751 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-29 20:09:54 +00:00
Malcolm Tredinnick f3c15225fc Fixed #6023 -- Fixed daylight savings determination for years beyond 2038 on
32-bit systems (modulo the fact that the system timezone libraries might not be
accurate that far out; at least we don't crash now). Thanks, SmileyChris.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6749 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-29 19:39:46 +00:00
Malcolm Tredinnick 260f9c5112 Fixed #5989 -- Fixed a problem with values being incorrectly reused by
reference in field subclassing. Thanks, flupke.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6748 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-29 19:30:49 +00:00
Malcolm Tredinnick 29892d02fa Fixed #6014 -- More robust error handling when validating decimal fields.
Thanks, pigletto.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6746 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-29 19:30:38 +00:00
Malcolm Tredinnick 7a166f1a1c Fixed #5959 -- Fixed handling of False values in hidden boolean fields. Thanks,
SmileyChris.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6745 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-29 19:22:03 +00:00
Malcolm Tredinnick 4cbc8c62cf Fixed #5939 -- Added normalization for New Brunswick in the Canadian provinces.
Thanks, rajesh.dhawan@gmail.com.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6744 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-29 18:15:46 +00:00
Malcolm Tredinnick d0f5a58fbd Fixed #4653 -- Improved the logic to decide when to include (and select as
initial value) the blank choice for a model field with choices. Thanks to
Ilya Semenov for persisting with this.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6733 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-29 16:32:18 +00:00
Malcolm Tredinnick b6002d4af6 Fixed #1291 -- Fixed a potential infinite loop for some URL constructions in
the development server. Thanks, Graham Carlyle.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6731 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-29 15:47:47 +00:00
Malcolm Tredinnick 3c272792d6 Added tests and a small optimisation for [6721]. Thanks SmileyChris. Fixed #6049
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6729 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-29 01:44:30 +00:00
Malcolm Tredinnick 9130765ff9 Fixed #5890 -- fixed the far edge-case of allowing constant strings inside
template template markers: we now treat embedded, escaped double quotes
consistently with constant string arguments to filters. Patch from Dmitri
Fedortchenko.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6724 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-28 21:04:05 +00:00
Malcolm Tredinnick 1c87a7bb58 Fixed #5730: Conditionally escape widget contents in newforms to avoid
inadvertent double-escaping. This still isn't perfect behaviour (since it's
unaware of the current context's auto-escaping setting), but that's a larger
problem that needs fixing and this change at least makes the existing
behaviour consistent. Patch from SmileyChris.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6722 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-28 20:19:54 +00:00
Gary Wilson Jr f110da91db Fixed #5993 -- Made `RadioSelect` easier to subclass by giving it a default `renderer` as a class attribute.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6717 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-26 02:39:48 +00:00
Gary Wilson Jr 5903b0bdcd Added a few more tests for `MultiValueDict`.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6715 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-25 18:16:40 +00:00
Malcolm Tredinnick 2e9e36e297 Fixed #5983 -- Made iriencode filter respect safe strings. Patch from
SmileyChris.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6706 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-20 01:37:57 +00:00
Gary Wilson Jr 6522e0697a Fixed #5932 -- Use `self.pages` and not `self._pages` in `_get_page_range` so that an exception is not raised if `self.page_range` is accessed before `self.pages`.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6702 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-19 06:10:23 +00:00
Gary Wilson Jr 34cc21983c Removed `vary_delim_re` in `django/utils/cache.py` in favor of existing `cc_delim_re` since the latter is more correct in parsing the header (allows whitespace before and after comma separators instead of just after). As a bonus, tests added for `patch_vary_headers()`.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6696 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-19 03:12:19 +00:00
Gary Wilson Jr b2b6fc8e3c Fixed #5975 -- Gave `ModelChoiceField` and `ModelMultipleChoiceField` ability to specify custom error messages.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6694 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-18 20:25:23 +00:00
Malcolm Tredinnick 5f8cfe99f3 Fixed #5969 -- Corrected a problem introduced in [6682].
*sigh* As usual, the one case I forget to test turned out to be broken.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6689 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-18 03:36:03 +00:00
Malcolm Tredinnick 4bd75e8712 Fixed a couple of chained filter tests that weren't demonstrating what they
claimed (since the "cut" filter's behaviour had changed since I originally
wrote those tests).


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6684 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-17 12:18:09 +00:00
Malcolm Tredinnick 4585b4d6c2 Fixed some missed auto-escaping and URL quoting cases in the urlize filter.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6683 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-17 12:12:40 +00:00
Malcolm Tredinnick adcec0885d Fixed a few problems with variable resolving inside of blocktrans tags. A couple of these were exposed by the auto-escaping changes, but I suspect the other one has been hiding in plain sight for a while.
Fixed #5952, #5953


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6682 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-17 12:12:18 +00:00
Malcolm Tredinnick 64c0bf8677 Translating safe strings should return a safe result.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6681 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-17 12:11:54 +00:00
Malcolm Tredinnick 0928fa5566 Fixed #5945 -- Treat string literals in template filter arguments as safe
strings for auto-escaping purposes.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6680 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-17 12:11:26 +00:00
Malcolm Tredinnick 0b0ef3f0c5 Fixed #4713 -- Fixed handling of _() in template tag arguments. Based on
patched from Indy and SmileyChris.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6679 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-17 04:04:12 +00:00
Malcolm Tredinnick bdb0b903c2 Content coming via {{ block.super }} is always going to be correctly escaped
already. We mark it as safe so that template authors don't need to.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6673 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-14 21:07:27 +00:00
Malcolm Tredinnick 356662cf74 Implemented auto-escaping of variable output in templates. Fully controllable by template authors and it's possible to write filters and templates that simulataneously work in both auto-escaped and non-auto-escaped environments if you need to. Fixed #2359
See documentation in templates.txt and templates_python.txt for how everything
works.

Backwards incompatible if you're inserting raw HTML output via template variables.

Based on an original design from Simon Willison and with debugging help from Michael Radziej.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6671 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-14 12:58:53 +00:00
Gary Wilson Jr babfe78494 Fixed #4787, #5913 -- Updating the queryset on a `ModelChoiceField` or `ModelMultipleChoiceField` now updates its widget's choices. The clean methods for `ModelChoiceField` and `ModelMultipleChoiceField` were changed to only allow choices in the specified queryset (instead of allowing all choices returned by the queryset model's default manager).
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6670 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-13 14:36:29 +00:00
Malcolm Tredinnick 3ee3d6b5f3 Fixed #5898 -- Changed a few response processing paths to make things harder to get wrong and easier to get right. Previous behaviour wasn't buggy, but it was harder to use than necessary.
We now have automatic HEAD processing always (previously required ConditionalGetMiddleware), middleware benefits from the Location header rewrite, so they can use relative URLs as well, and responses with response codes 1xx, 204 or 304 will always have their content removed, in accordance with the HTTP spec (so it's much harder to indavertently deliver invalid responses).

Based on a patch and diagnosis from regexbot@gmail.com.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6662 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-11 03:55:44 +00:00
Malcolm Tredinnick 30848dfe34 When using assertRedirect(), allow the caller to specify relative URLs and
automatically fill in the hostname and scheme (host can be passed in, if
different from the default).


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6661 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-11 03:54:21 +00:00
Gary Wilson Jr 1eecc5a47e Corrected a couple comments in `model_forms` tests.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6660 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-09 19:35:56 +00:00
Luke Plant 8eeb9feab0 Fixed #4376 -- login_required now works with bound methods. Thanks, Steven Bethard.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6658 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-07 22:45:07 +00:00
Malcolm Tredinnick ea100b607a Added the small changes necessary to make creating custom model fields easier.
Also includes some tests for this.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6651 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-05 13:59:42 +00:00
Gary Wilson Jr a5eb61cd9f Added tests for `floatformat` template filter for number with non-zero decimal place digit and ending in zeros.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6647 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-04 02:32:02 +00:00
Malcolm Tredinnick 77a846bab0 Fixed a Python 2.3 problem.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6644 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-04 02:08:15 +00:00
Gary Wilson Jr 8c442f21dc Fixed #5816 -- Fixed a regression from [6333] that generates incorrect cookie "expires" dates when using a locale other than English. Introduced `http_date` and `cookie_date` utility functions. Thanks for the report Michael Lemaire. Thanks for the patch Karen Tracey and `SmileyChris`.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6634 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-31 03:59:40 +00:00
Gary Wilson Jr 26ea06b0ab Fixed #3457 -- Allow overridding of error messages for newforms Fields.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6625 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-28 05:40:26 +00:00
Malcolm Tredinnick 1580630fbd Removed an "XFAIL" marker that was accidentally hanging around since the
unicode branch days.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6619 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-27 06:23:19 +00:00