summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--paste/errordocument.py8
-rw-r--r--paste/fixture.py12
2 files changed, 16 insertions, 4 deletions
diff --git a/paste/errordocument.py b/paste/errordocument.py
index fce1efb..20e4b0c 100644
--- a/paste/errordocument.py
+++ b/paste/errordocument.py
@@ -100,7 +100,7 @@ def forward(app, codes):
return None
return _StatusBasedRedirect(app, error_codes_mapper, codes=codes)
-def custom_forward(app, mapper, global_conf={}, **kw):
+def custom_forward(app, mapper, global_conf=None, **kw):
"""
Intercepts a response with a particular status code and returns the
content from the URL specified by a user-defined mapper object
@@ -177,6 +177,8 @@ def custom_forward(app, mapper, global_conf={}, **kw):
return None
return custom_forward(app, error_codes_mapper, codes=codes)
"""
+ if global_conf is None:
+ global_conf = {}
return _StatusBasedRedirect(app, mapper, global_conf, **kw)
class _StatusBasedRedirect:
@@ -185,7 +187,9 @@ class _StatusBasedRedirect:
the documentation for ``error_document_mapper`` for details or
``error_document_redirect()`` for an different example of its use.
"""
- def __init__(self, app, mapper, global_conf={}, **kw):
+ def __init__(self, app, mapper, global_conf=None, **kw):
+ if global_conf is None:
+ global_conf = {}
self.application = app
self.mapper = mapper
self.global_conf = global_conf
diff --git a/paste/fixture.py b/paste/fixture.py
index c2a694b..9cfebfa 100644
--- a/paste/fixture.py
+++ b/paste/fixture.py
@@ -139,7 +139,7 @@ class TestApp(object):
environ['paste.throw_errors'] = True
return environ
- def get(self, url, params=None, headers={}, extra_environ={},
+ def get(self, url, params=None, headers=None, extra_environ=None,
status=None, expect_errors=False):
"""
Get the given url (well, actually a path like
@@ -171,6 +171,10 @@ class TestApp(object):
Returns a `response object
<class-paste.fixture.TestResponse.html>`_
"""
+ if headers is None:
+ headers = {}
+ if extra_environ is None:
+ extra_environ = {}
# Hide from py.test:
__tracebackhide__ = True
if params:
@@ -193,7 +197,7 @@ class TestApp(object):
req = TestRequest(url, environ, expect_errors)
return self.do_request(req, status=status)
- def post(self, url, params='', headers={}, extra_environ={},
+ def post(self, url, params='', headers=None, extra_environ=None,
status=None, upload_files=None, expect_errors=False):
"""
Do a POST request. Very like the ``.get()`` method.
@@ -207,6 +211,10 @@ class TestApp(object):
Returns a `response object
<class-paste.fixture.TestResponse.html>`_
"""
+ if headers is None:
+ headers = {}
+ if extra_environ is None:
+ extra_environ = {}
environ = self._make_environ()
# @@: Should this be all non-strings?
if params and isinstance(params, (list, tuple, dict)):