diff --git a/AUTHORS b/AUTHORS
index e52fb46b47..9c7463551a 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -126,6 +126,7 @@ answer newbie questions, and generally made Django that much better:
Oliver Rutherfurd
Ivan Sagalaev (Maniac)
David Schein
+ Pete Shinners
sopel
Thomas Steinacher
Radek Švarz
diff --git a/django/utils/datastructures.py b/django/utils/datastructures.py
index 632e804f26..6aef313d35 100644
--- a/django/utils/datastructures.py
+++ b/django/utils/datastructures.py
@@ -187,17 +187,23 @@ class MultiValueDict(dict):
"Returns a copy of this object."
return self.__deepcopy__()
- def update(self, other_dict):
- "update() extends rather than replaces existing key lists."
- if isinstance(other_dict, MultiValueDict):
- for key, value_list in other_dict.lists():
- self.setlistdefault(key, []).extend(value_list)
- else:
- try:
- for key, value in other_dict.items():
- self.setlistdefault(key, []).append(value)
- except TypeError:
- raise ValueError, "MultiValueDict.update() takes either a MultiValueDict or dictionary"
+ def update(self, *args, **kwargs):
+ "update() extends rather than replaces existing key lists. Also accepts keyword args."
+ if len(args) > 1:
+ raise TypeError, "update expected at most 1 arguments, got %d", len(args)
+ if args:
+ other_dict = args[0]
+ if isinstance(other_dict, MultiValueDict):
+ for key, value_list in other_dict.lists():
+ self.setlistdefault(key, []).extend(value_list)
+ else:
+ try:
+ for key, value in other_dict.items():
+ self.setlistdefault(key, []).append(value)
+ except TypeError:
+ raise ValueError, "MultiValueDict.update() takes either a MultiValueDict or dictionary"
+ for key, value in kwargs.iteritems():
+ self.setlistdefault(key, []).append(value)
class DotExpandedDict(dict):
"""