=== modified file 'django/template/defaultfilters.py'
|
|
|
|
| 172 | 172 | return truncate_html_words(value, length) |
| 173 | 173 | truncatewords_html = stringfilter(truncatewords_html) |
| 174 | 174 | |
| | 175 | def uncapfirst(value): |
| | 176 | "Uncapitalizes the first character of the value" |
| | 177 | if len(value) > 1: |
| | 178 | if value[1].islower(): |
| | 179 | return value[0].lower() + value[1:] |
| | 180 | else: |
| | 181 | return value |
| | 182 | else: |
| | 183 | return value.lower() |
| | 184 | uncapfirst = stringfilter(uncapfirst) |
| | 185 | |
| 175 | 186 | def upper(value): |
| 176 | 187 | "Converts a string into all uppercase" |
| 177 | 188 | return value.upper() |
| … |
… |
|
| 649 | 660 | register.filter(title) |
| 650 | 661 | register.filter(truncatewords) |
| 651 | 662 | register.filter(truncatewords_html) |
| | 663 | register.filter(uncapfirst) |
| 652 | 664 | register.filter(unordered_list) |
| 653 | 665 | register.filter(upper) |
| 654 | 666 | register.filter(urlencode) |
=== modified file 'django/utils/text.py'
|
|
|
|
| 8 | 8 | capfirst = lambda x: x and force_unicode(x)[0].upper() + force_unicode(x)[1:] |
| 9 | 9 | capfirst = allow_lazy(capfirst, unicode) |
| 10 | 10 | |
| | 11 | # Uncapitalizes the first letter of a string. |
| | 12 | def uncapfirst(x): |
| | 13 | x = force_unicode(x) |
| | 14 | if len(x) > 1: |
| | 15 | if x[1].islower(): |
| | 16 | return x[0].lower() + x[1:] |
| | 17 | else: |
| | 18 | return x |
| | 19 | else: |
| | 20 | return x.lower() |
| | 21 | uncapfirst = allow_lazy(uncapfirst, unicode) |
| | 22 | |
| 11 | 23 | def wrap(text, width): |
| 12 | 24 | """ |
| 13 | 25 | A word-wrap function that preserves existing line breaks and most spaces in |