Made `MultiValueDict`'s `get` and `getlist` method docstrings more descriptive.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@6714 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Gary Wilson Jr 2007-11-25 18:14:18 +00:00
parent 891cc5df92
commit c7181ec0ff
1 changed files with 8 additions and 2 deletions

View File

@ -211,7 +211,10 @@ class MultiValueDict(dict):
return result return result
def get(self, key, default=None): def get(self, key, default=None):
"""Returns the default value if the requested data doesn't exist.""" """
Returns the last data value for the passed key. If key doesn't exist
or value is an empty list, then default is returned.
"""
try: try:
val = self[key] val = self[key]
except KeyError: except KeyError:
@ -221,7 +224,10 @@ class MultiValueDict(dict):
return val return val
def getlist(self, key): def getlist(self, key):
"""Returns an empty list if the requested data doesn't exist.""" """
Returns the list of values for the passed key. If key doesn't exist,
then an empty list is returned.
"""
try: try:
return super(MultiValueDict, self).__getitem__(key) return super(MultiValueDict, self).__getitem__(key)
except KeyError: except KeyError: