diff options
-rw-r--r-- | docs/do-it-yourself-framework.txt | 2 | ||||
-rw-r--r-- | docs/news.txt | 6 | ||||
-rw-r--r-- | paste/request.py | 12 | ||||
-rw-r--r-- | paste/util/multidict.py | 14 | ||||
-rw-r--r-- | paste/wsgiwrappers.py | 6 | ||||
-rw-r--r-- | tests/test_request.py | 2 |
6 files changed, 24 insertions, 18 deletions
diff --git a/docs/do-it-yourself-framework.txt b/docs/do-it-yourself-framework.txt index 995ac42..9d6b2c1 100644 --- a/docs/do-it-yourself-framework.txt +++ b/docs/do-it-yourself-framework.txt @@ -123,7 +123,7 @@ fields:: The ``parse_formvars`` function just takes the WSGI environment and calls the `cgi <http://python.org/doc/current/lib/module-cgi.html>`_ -module (the ``FieldStorage`` class) and turns that into a multidict. +module (the ``FieldStorage`` class) and turns that into a MultiDict. Now For a Framework =================== diff --git a/docs/news.txt b/docs/news.txt index 4ceb87d..0effa51 100644 --- a/docs/news.txt +++ b/docs/news.txt @@ -3,6 +3,12 @@ News .. contents:: +0.9.6 +----- + +* Renamed the ``paste.util.multidict.multidict`` class to + ``paste.util.multidict.MultiDict`` + 0.9.5 ----- diff --git a/paste/request.py b/paste/request.py index 082f6bb..bc172a0 100644 --- a/paste/request.py +++ b/paste/request.py @@ -23,7 +23,7 @@ from Cookie import SimpleCookie from StringIO import StringIO import urlparse from util.UserDict24 import DictMixin, IterableUserDict, UserDict -from paste.util.multidict import multidict +from paste.util.multidict import MultiDict __all__ = ['get_cookies', 'get_cookie_dict', 'parse_querystring', 'parse_formvars', 'construct_url', 'path_info_split', @@ -93,7 +93,7 @@ def parse_querystring(environ): return parsed def parse_dict_querystring(environ): - """Parses a query string like parse_querystring, but returns a multidict + """Parses a query string like parse_querystring, but returns a MultiDict Caches this value in case parse_dict_querystring is called again for the same request. @@ -120,15 +120,15 @@ def parse_dict_querystring(environ): return parsed parsed = cgi.parse_qsl(source, keep_blank_values=True, strict_parsing=False) - multi = multidict(parsed) + multi = MultiDict(parsed) environ['paste.parsed_dict_querystring'] = (multi, source) return multi def parse_formvars(environ, include_get_vars=True): - """Parses the request, returning a multidict of form variables. + """Parses the request, returning a MultiDict of form variables. If ``include_get_vars`` is true then GET (query string) variables - will also be folded into the multidict. + will also be folded into the MultiDict. All values should be strings, except for file uploads which are left as FieldStorage instances. @@ -167,7 +167,7 @@ def parse_formvars(environ, include_get_vars=True): if fake_out_cgi: environ['CONTENT_TYPE'] = old_content_type environ['CONTENT_LENGTH'] = old_content_length - formvars = multidict() + formvars = MultiDict() if isinstance(fs.value, list): for name in fs.keys(): values = fs[name] diff --git a/paste/util/multidict.py b/paste/util/multidict.py index cec3ce7..3d1cc46 100644 --- a/paste/util/multidict.py +++ b/paste/util/multidict.py @@ -2,7 +2,7 @@ # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php from UserDict import DictMixin -class multidict(DictMixin): +class MultiDict(DictMixin): """ An ordered dictionary that can have multiple values for each key. @@ -13,7 +13,7 @@ class multidict(DictMixin): def __init__(self, *args, **kw): if len(args) > 1: raise TypeError( - "multidict can only be called with one positional argument") + "MultiDict can only be called with one positional argument") if args: if hasattr(args[0], 'iteritems'): items = list(args[0].iteritems()) @@ -112,7 +112,7 @@ class multidict(DictMixin): self._items = [] def copy(self): - return multidict(self) + return MultiDict(self) def setdefault(self, key, default=None): for k, v in self._items: @@ -154,7 +154,7 @@ class multidict(DictMixin): def __repr__(self): items = ', '.join(['(%r, %r)' % v for v in self._items]) - return 'multidict([%s])' % items + return 'MultiDict([%s])' % items def __len__(self): return len(self._items) @@ -187,7 +187,7 @@ class multidict(DictMixin): __test__ = { 'general': """ - >>> d = multidict(a=1, b=2) + >>> d = MultiDict(a=1, b=2) >>> d['a'] 1 >>> d.getall('c') @@ -206,8 +206,8 @@ __test__ = { [('a', 1), ('a', 2), ('b', 4)] >>> d.mixed() {'a': [1, 2], 'b': 4} - >>> multidict([('a', 'b')], c=2) - multidict([('a', 'b'), ('c', 2)]) + >>> MultiDict([('a', 'b')], c=2) + MultiDict([('a', 'b'), ('c', 2)]) """} if __name__ == '__main__': diff --git a/paste/wsgiwrappers.py b/paste/wsgiwrappers.py index e471aef..84a0924 100644 --- a/paste/wsgiwrappers.py +++ b/paste/wsgiwrappers.py @@ -2,7 +2,7 @@ # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php import paste.httpexceptions from paste.request import EnvironHeaders, parse_formvars, parse_dict_querystring, get_cookie_dict -from paste.util.multidict import multidict +from paste.util.multidict import MultiDict from paste.response import HeaderDict import paste.registry as registry import paste.httpexceptions @@ -89,7 +89,7 @@ class WSGIRequest(object): POST = property(POST, doc=POST.__doc__) def params(self): - """multidict of keys from POST, GET, URL dicts + """MultiDict of keys from POST, GET, URL dicts Return a key value from the parameters, they are checked in the following order: POST, GET, URL @@ -100,7 +100,7 @@ class WSGIRequest(object): Returns a list of all the values by that key, collected from POST, GET, URL dicts """ - pms = multidict() + pms = MultiDict() pms.update(self.POST) pms.update(self.GET) return pms diff --git a/tests/test_request.py b/tests/test_request.py index 115ff71..0915cb0 100644 --- a/tests/test_request.py +++ b/tests/test_request.py @@ -21,5 +21,5 @@ def test_gets(): assert "get is {}" in res res = app.get('/?name=george') - res.mustcontain("get is multidict([('name', 'george')])") + res.mustcontain("get is MultiDict([('name', 'george')])") res.mustcontain("Val is george") |