[Django] #24165: add request.messages attribute

2 views
Skip to first unread message

Django

unread,
Jan 16, 2015, 10:44:50 PM1/16/15
to django-...@googlegroups.com
#24165: add request.messages attribute
----------------------------------+--------------------
Reporter: collinanderson | Owner: nobody
Type: New feature | Status: new
Component: contrib.messages | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+--------------------
It seems to me, similar to `request.user`, it would be nice to expose
`request.messages` if the messages middleware is installed.

--
Ticket URL: <https://code.djangoproject.com/ticket/24165>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jan 16, 2015, 10:46:11 PM1/16/15
to django-...@googlegroups.com
#24165: add request.messages attribute
----------------------------------+--------------------------------------

Reporter: collinanderson | Owner: nobody
Type: New feature | Status: new
Component: contrib.messages | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
----------------------------------+--------------------------------------
Changes (by collinanderson):

* needs_better_patch: => 0
* has_patch: 0 => 1
* needs_tests: => 0
* needs_docs: => 0


Comment:

https://github.com/django/django/pull/3937

--
Ticket URL: <https://code.djangoproject.com/ticket/24165#comment:1>

Django

unread,
Jan 17, 2015, 7:29:53 AM1/17/15
to django-...@googlegroups.com
#24165: add request.messages attribute
----------------------------------+--------------------------------------
Reporter: collinanderson | Owner: nobody
Type: New feature | Status: new
Component: contrib.messages | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
----------------------------------+--------------------------------------

Comment (by timgraham):

Did you research the decision about putting `request.user` where it is?
I'm not sure the rationale of setting attributes on the `request` instead
of using context processors is a good one. If this is simply an effort to
avoid context processors, have you considered other alternatives like a
template tag?

--
Ticket URL: <https://code.djangoproject.com/ticket/24165#comment:2>

Django

unread,
Jan 18, 2015, 1:05:32 PM1/18/15
to django-...@googlegroups.com
#24165: add request.messages attribute
----------------------------------+--------------------------------------
Reporter: collinanderson | Owner: nobody
Type: New feature | Status: new
Component: contrib.messages | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
----------------------------------+--------------------------------------

Comment (by collinanderson):

`request.user` has been there since day 1
https://github.com/django/django/commit/ed114e15106192b22ebb78ef5bf5bce72b419d13
#diff-461e26928e3d218ad38c12d949a512a8R79

It's more of a proposal (yeah, maybe I should put it on the mailing list
instead). I also figure we're doing that anyway behind the scenes. I've
used custom attributes of request a lot myself and it's worked well. One
big advantage is being able to use the same syntax in views and templates.

But yes, it's mostly to allow avoiding context_processors :) The template
tag wouldn't work quite as well in this case, because it needs the request
object. You would need to say `{% load messages %}{% get_messages request
as messages %}` which I personally think is a bit verbose, but I might be
open to it.

I'm also fine with holding off for now.

--
Ticket URL: <https://code.djangoproject.com/ticket/24165#comment:3>

Django

unread,
Jan 19, 2015, 6:57:12 PM1/19/15
to django-...@googlegroups.com
#24165: add request.messages attribute
----------------------------------+--------------------------------------
Reporter: collinanderson | Owner: nobody
Type: New feature | Status: closed
Component: contrib.messages | Version: master
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage: Unreviewed

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
----------------------------------+--------------------------------------
Changes (by timgraham):

* status: new => closed
* resolution: => needsinfo


--
Ticket URL: <https://code.djangoproject.com/ticket/24165#comment:4>

Reply all
Reply to author
Forward
0 new messages