﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
21412	Django message framework called with None	merb	Denis Cornehl	"Currently, this is a very small bug and i don't now the first occurance, since i first used the message framework at the last evening.

I used Django 1.6 and installed everything. I put the Message Framework into the middleware, the context preprocessor and the INSTALLED APPS.
And then I did something which happend, cause i was very sleepy.

I made a generic.FormView like this:

{{{
class CreateUserView(generic.FormView):
    template_name = 'envisia_backup/create_user.html'
    form_class = UserForm

    def get_success_url(self):
        return reverse('envisia:index')

    def form_valid(self, form):
        data = form.cleaned_data
        user = User.objects.create(**data)
        user.is_staff = True
        user.is_superuser = True
        user.save()
        messages.success(request, 'User erfolgreich erstellt!')
        return HttpResponseRedirect(self.get_success_url())
}}}

Since I was sleepy I really didn't know where the mistake was.
The error message always was that the message framework wasn't installed and I should put it in the middleware and in the INSTALLED_APPS.

Why did this happen? Currently it happend cause I called messages.success with None.
request wasn't defined. so it was None. It took a while since I found the error since I never got a correct error message.

Currently the fix would be really simple. But I don't want to make a patch until know since I don't know if it is wished that the messages framework should make a assert if we call it with a Request object or not.
If it is wished that the message framework could only be called with a request object, than i would make a patch with a corresponding test. But only if this is really wished."	Bug	closed	contrib.messages	1.6	Normal	fixed	messages	c.schmitt@…	Ready for checkin	0	0	0	0	1	0
