#14976: Add is_html flag to contrib.messages
-----------------------------------+----------------------------------------
Reporter: tedtieken | Owner: nobody
Status: new | Milestone:
Component: Contrib apps | Version: 1.2
Resolution: | Keywords: safe, messages, html
Stage: Accepted | Has_patch: 1
Needs_docs: 1 | Needs_tests: 1
Needs_better_patch: 0 |
-----------------------------------+----------------------------------------
Changes (by tedtieken):
* needs_docs: 0 => 1
* has_patch: 0 => 1
* needs_tests: 0 => 1
Comment:
I coded up a patch, and it is passing previous tests on my system.
Need to write new tests:
- ensure it is accurately recovering legacy messages
- test that the is_html tag is being set and retrieved as expected
Passing legacy tests says to me that api backward compatibility has been
achieved.
Of note: In base test_multiple_posts(): had to reduce the number of test
messages per level from 10 to 9 (from 50 to 45 messages total. 10
appeared to be pushing past the cookie size limit.)
Also of note: To get backward compatibility I had to write the api
functions as
{{{
def debug(request, message, extra_tags='', fail_silently=False,
is_html=False):
instead of
def debug(request, message, extra_tags='', is_html=False,
fail_silently=False):
}}}
The later would be more intuitive [request], [message_content],
[optional_message_content], [optional_message_content], [behavior_flag].
Given that positional arguments are now non-intuitively ordered, the docs
should probably encourage or at least show examples using keyword
arguments:
{{{
messages.debug(request, "my message", extra_tags="markup this_way",
is_html=True)
}}}
--
Ticket URL: <http://code.djangoproject.com/ticket/14976#comment:6>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.