Re: Message level API awkwardness
That sounds like a pretty simple addition that won't affect (m)any folks, so I'm fine with adding such a wrapper. I'd prefer the methods be called 'get_level' and 'set_level', however, so they're shorter and match the naming of 'get_messages'. Others? On Wed, Jan 6, 2010 at 6:09 PM, Jeremy Dunck wrote: > I realize I'm very late giving feedback on the API, sorry and feel > free to ignore if I'm too late. > > That said, from the docs, the API to set the effective messaging level > is awkward: > > == > # Change the messages level to ensure the debug message is added. > messages.get_messages(request).level = messages.DEBUG > == > > To *set* the messaging level, I call .get_messages? > > I think I understand the reason this was done-- get_messages is > backend- and request-specific, but it is definitely surprising. > > Perhaps something like this would do better? > > messages.effective_level(request) => messages.INFO > messages.set_effective_level(request, messages.DEBUG) > ? > > Behind the scenes, it could be almost the same implementation. > > -- > You received this message because you are subscribed to the Google Groups > "Django developers" group. > To post to this group, send email to django-develop...@googlegroups.com. > To unsubscribe from this group, send email to > django-developers+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-developers?hl=en. > > > > -- Tobias McNulty Caktus Consulting Group, LLC P.O. Box 1454 Carrboro, NC 27510 (919) 951-0052 http://www.caktusgroup.com -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-develop...@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
Re: Message level API awkwardness
On Jan 6, 11:09 pm, Jeremy Dunck wrote: > I realize I'm very late giving feedback on the API, sorry and feel > free to ignore if I'm too late. > > That said, from the docs, the API to set the effective messaging level > is awkward: > > == > # Change the messages level to ensure the debug message is added. > messages.get_messages(request).level = messages.DEBUG > == > > To *set* the messaging level, I call .get_messages? > > I think I understand the reason this was done-- get_messages is > backend- and request-specific, but it is definitely surprising. > > Perhaps something like this would do better? > > messages.effective_level(request) => messages.INFO > messages.set_effective_level(request, messages.DEBUG) > ? > Yes, that sounds good. I also like Tobias' names better -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-develop...@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
Re: Message level API awkwardness
On Fri, Jan 8, 2010 at 7:10 AM, SmileyChris wrote: > > > On Jan 6, 11:09 pm, Jeremy Dunck wrote: >> I realize I'm very late giving feedback on the API, sorry and feel >> free to ignore if I'm too late. >> >> That said, from the docs, the API to set the effective messaging level >> is awkward: >> >> == >> # Change the messages level to ensure the debug message is added. >> messages.get_messages(request).level = messages.DEBUG >> == >> >> To *set* the messaging level, I call .get_messages? >> >> I think I understand the reason this was done-- get_messages is >> backend- and request-specific, but it is definitely surprising. >> >> Perhaps something like this would do better? >> >> messages.effective_level(request) => messages.INFO >> messages.set_effective_level(request, messages.DEBUG) >> ? >> > Yes, that sounds good. I also like Tobias' names better I concur. get_level()/set_level() sounds like a reasonable change to me. Can I have that in the form of a ticket and patch? :-) Russ %-) -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-develop...@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
Re: Message level API awkwardness
On Jan 11, 2:12 pm, Russell Keith-Magee wrote: > I concur. get_level()/set_level() sounds like a reasonable change to > me. Can I have that in the form of a ticket and patch? :-) http://code.djangoproject.com/ticket/12575 -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-develop...@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.