Commit Graph

41 Commits

Author SHA1 Message Date
Malcolm Tredinnick 516102dc75 FIxed #6513 -- Handle overflows better in the floatformat filter. It's not
possible to test this automatically everywhere due to differing representations
on different platforms. Manual testing confirms it works, though.

Thanks, Karen Tracey.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7336 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-20 07:36:33 +00:00
Gary Wilson Jr 5ca0b9203b Fixed #5701 -- Fixed decorators to take the name, attributes, and docstring of the function they decorate by adding a modified version of the `functools.wraps` function from Python 2.5. `wraps` has been altered to work with Django's `curry` function and with Python 2.3, which doesn't allow assignment of a function's `__name__` attribute. This fixes severaly annoyances, such as the online documentation for template filters served by the admin app. This change is backwards incompatible if, for some reason, you were relying on the name of a Django decorator instead of the function it decorates.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7153 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-25 06:02:35 +00:00
Gary Wilson Jr f780ce6176 Fixed #6471 -- Fixed stringfilter decoration of `force_escape` filter.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7033 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-01-28 02:30:53 +00:00
Malcolm Tredinnick a7da12d320 Fixed #5567 -- Added a "last" filter. Based on a patch from darkpixel.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6998 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-01-06 03:53:33 +00:00
Malcolm Tredinnick 1f6bc7ffa7 The "first" filter can return an unsafe string for safe input ( {{"<"|first}} ), so change is_safe to False. Refs #5567.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6997 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-01-06 03:53:04 +00:00
Malcolm Tredinnick 367867845f Fixed #6239 -- Fixed an auto-escaping problem with urlizetrunc. Thanks, SmileyChris.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6950 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-19 04:20:02 +00:00
Jacob Kaplan-Moss 25f548a852 Fixed #6132: note to self: when you add new template tags, you need to remember to actually register them. Thanks, Ben Walton.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6897 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-05 13:16:25 +00:00
Jacob Kaplan-Moss b65fce6595 Fixed #4131: added an "escapejs" filter for use in JavaScript strings, and updated the documentation on addslashes to point to the new ticket. Featuring contributions from Ned Batchelder, Jeremy Dunck, and Andy Durdin.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6892 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-04 21:08:29 +00:00
Adrian Holovaty a73588aa58 Edited docs/serialization.txt changes from [6645]
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6787 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-01 16:58:52 +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 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 dc716112a7 Fixed an edge-case for auto-escaping: if the stringfilter decorator is used and
generates a first argument that is a safe string, make the is_safe handling
work as expect.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6721 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-28 20:03:28 +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
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 72b7a33929 `floatformat` template filter docstring changes:
* Split example cases.
 * Corrected use with negative arguments (quotes are needed).
 * Added another example of a number that has decimal places that include a non-zero digit and that ends with zeros.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6646 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-04 02:27:17 +00:00
Gary Wilson Jr 99697d9bec Added examples to the `pluralize` template filter's docstring.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6643 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-04 02:08:04 +00:00
Gary Wilson Jr 4e8864a882 Style and import fixes.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6641 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-04 02:05:56 +00:00
Jacob Kaplan-Moss 2570954a9a Fixed #3453: introduced a new template variable resolution system by Brian Harring (thanks!). The upshot is that variable resolution is about 25% faster, and you should see a measurable performance increase any time you've got long or deeply nested loops.
Variable resolution has changed behind the scenes -- see the note in templates_python.txt -- but template.resolve_variable() still exists. This should be fully backwards-compatible.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6399 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-21 04:00:32 +00:00
Adrian Holovaty cadc6e8c9f Fixed #4658 -- Improved documentation of linebreaks and linebreaksbr. Thanks, ubernostrum and Gary Wilson
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6223 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-14 21:46:38 +00:00
Gary Wilson Jr 1a1a58c9f8 Fixed #3184 -- Changed the `unordered_list` template filter to use a more simple format, while maintaining backwards compatibility with the old format. `unordered_list` now works with a simple list of items. Thanks for the patch, SmileyChris.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6019 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-26 01:11:20 +00:00
Malcolm Tredinnick e27a7ef360 Fixed #4842 -- Added slightly more robust error reporting. Thanks, Thomas
Güttler.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5682 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-13 10:56:30 +00:00
Malcolm Tredinnick 953badbea5 Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.

Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04 12:11:04 +00:00
Malcolm Tredinnick 00cb6a1ba8 Fixed #4107 -- Marked a few more strings for translation. Thanks, Baptiste.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5061 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-23 05:51:29 +00:00
Malcolm Tredinnick 659aa8f01a Fixed #3693 -- Fixed RST error in floatformat docstring. Thanks, Simon
Greenhill.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4699 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-10 08:11:28 +00:00
Jacob Kaplan-Moss e7aab3a474 Fixed #3558: [4558] broken in Python 2.3; this fixes that breakage. Thanks for the heads-up, xian@mintchaos.com
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4562 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-23 23:05:16 +00:00
Jacob Kaplan-Moss 36512d5d73 Fixed #343: filters that take strings now handle non-strings correctly. Thanks to Boffbowsh for the original patch, and to SmileyChris for the updated patch and tests.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4558 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-23 18:02:51 +00:00
Malcolm Tredinnick a4ddecd15c Fixed #3155 -- Allow an integer to be passed to the urlencode filter. Patch
based on one from SmileyChris.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4496 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-13 05:50:55 +00:00
Malcolm Tredinnick 5a0b72a6eb Fixed #2027 -- added truncatewords_html filter that respects HTML tags whilst
truncating. Patch from SmileyChris.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4468 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-02-10 02:51:27 +00:00
Russell Keith-Magee c3f891210a Fixes #3176, #3004 -- Added an argument to the floatfilter to allow users to specify precision of floats, Thanks, Eric Floehr.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4274 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-01-03 05:29:34 +00:00
Jacob Kaplan-Moss 92151b2d28 Fixed #2914: filesizeformat no longer dies on invalid values. Thanks, dev@simon.net.nz
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4044 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-07 04:58:10 +00:00
Malcolm Tredinnick 670e8ab704 Fixed #2456 -- Added backslash escaping to addslashes, which is necessary once
you start escaping other things. Thanks, tom@eggdrop.ch.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3799 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-09-23 08:41:09 +00:00
Adrian Holovaty 74f5d2b9b0 Fixed #2528 -- Fixed 'time' template filter for midnight time value. Thanks, django@dougma.com
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3563 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-08-12 05:09:12 +00:00
Jacob Kaplan-Moss 1687b025dc Part 3 of pedant day: replaced all tabs in Django with spaces. Python the way Guido intended it, baby!
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3415 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-07-21 20:48:17 +00:00
Malcolm Tredinnick f8a277bc7f Fixed a small typo in the wordwrap filter's docstring.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3353 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-07-15 11:47:09 +00:00
Russell Keith-Magee 5ac919b711 Refs #2202 -- Cleaned up technique of splitting arguments, based upon a suggestion from SmileyChris.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3273 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-07-04 06:31:26 +00:00
Russell Keith-Magee b9d9351e85 Fixes #2202 -- Added ability to customize output of pluralize filter to handle irregular cases (walrus/walruses, cherry/cherries). Thanks to gid for the suggestion and the initial patch
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3272 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-07-04 06:18:39 +00:00
Malcolm Tredinnick 239adf83d3 Fixed #2053 -- added an optional comparison argument to the "timesince" filter.
Added a "timeuntil" filter that works analogously. Thanks, john@sneeu.com.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3185 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-21 06:56:08 +00:00
Malcolm Tredinnick bff39bfb8c Fixed #2127 -- Made datetime filters fail silently when passed empty strings or
None. Thanks, Gary Wilson.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3117 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-11 00:33:44 +00:00
Adrian Holovaty c643e12faf Fixed #1321 -- Made DJANGO_SETTINGS_MODULE optional. You can now call django.conf.settings.configure() to set settings manually if you don't have a settings module. Thanks, Malcolm Tredinnick, Luke Plant, Fredrik Lundh
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2927 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-16 21:28:06 +00:00
Adrian Holovaty 51f6a9442c Fixed #1849 -- Slugifying now collapses consecutive hyphens to a single hyphen. Thanks, Tom Insam
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2905 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-15 04:20:04 +00:00
Adrian Holovaty f69cf70ed8 MERGED MAGIC-REMOVAL BRANCH TO TRUNK. This change is highly backwards-incompatible. Please read http://code.djangoproject.com/wiki/RemovingTheMagic for upgrade instructions.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2809 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-02 01:31:56 +00:00