﻿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
15166	Code error in ValidationError.update_error_dict	zvikico	nobody	"There's a minor bug in ValidationError.update_error_dict. The code receives an error_dict which might be None (and perhaps it should have a default None value).
The code has two options, one when a message_dict exists and one that it doesn't.
If the message_dict exists, the code checks for a null error_dict and returns the message_dict instead. 
If the message_dict does not exist, the code assumes the error_dict input is a dict without checking for None. 

Here's a suggested alternative for the code:

{{{
    def update_error_dict(self, error_dict = None):
        if hasattr(self, 'message_dict'):
            if error_dict:
                for k, v in self.message_dict.items():
                    error_dict.setdefault(k, []).extend(v)
            else:
                error_dict = self.message_dict
        else:
            if error_dict:
                error_dict[NON_FIELD_ERRORS] = self.messages
            else:
                error_dict = { NON_FIELD_ERRORS: self.messages, }
        return error_dict
}}}
"	Bug	closed	Core (Other)	1.3-beta	Normal	invalid		bmispelon@…	Accepted	1	0	1	0	0	0
