diff options
| author | Chris McDonough <chrism@plope.com> | 2011-03-18 15:53:40 -0400 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2011-03-18 15:53:40 -0400 |
| commit | 097d37558c54f3cbee90d89950516087a5200aa0 (patch) | |
| tree | 658e8c7f39fff4d43f533d0352dc8cb4e6f35771 | |
| parent | 330042f92661928de977efe5e3c5a33c15bef9fb (diff) | |
| download | pyramid-097d37558c54f3cbee90d89950516087a5200aa0.tar.gz pyramid-097d37558c54f3cbee90d89950516087a5200aa0.tar.bz2 pyramid-097d37558c54f3cbee90d89950516087a5200aa0.zip | |
add more docstring to DummyRequest: Closes #150
| -rw-r--r-- | pyramid/testing.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/pyramid/testing.py b/pyramid/testing.py index c4ba2584b..027cd384e 100644 --- a/pyramid/testing.py +++ b/pyramid/testing.py @@ -618,7 +618,7 @@ class DummySession(dict): return self.get('_csrft_', None) class DummyRequest(object): - """ A dummy request object (imitates a :term:`request` object). + """ A DummyRequest object (incompletely) imitates a :term:`request` object. The ``params``, ``environ``, ``headers``, ``path``, and ``cookies`` arguments correspond to their :term`WebOb` @@ -632,6 +632,17 @@ class DummyRequest(object): Extra keyword arguments are assigned as attributes of the request itself. + Note that DummyRequest does not have complete fidelity with a "real" + request. For example, by default, the DummyRequest ``GET`` and ``POST`` + attributes are of type ``dict``, unlike a normal Request's GET and POST, + which are of type ``MultiDict``. If your code uses the features of + MultiDict, you should either use a"real" :class:`pyramid.request.Request` + or adapt your DummyRequest by replacing the attributes with ``MultiDict`` + instances. + + Other similar incompatibilities exist. If you need all the features of + a Request, use the :class:`pyramid.request.Request` class itself rather + than this class while writing tests. """ implements(IRequest) method = 'GET' |
