Skip to content
Browse files

Copy the headers dictionary in WebAPIResponseError.

We were defaulting the headers parameter to the WebAPIResponseError
constructor to None and then creating a new dictionary if it was None. The
reason for this is that we modify the dictionary and don't want to risk
that going into the static default dictionary for the parameter (as this
would impact future instances). However, the right solution is just to
copy the dictionary.
  • Loading branch information...
1 parent bb2e26b commit ef1a8e03f7165b613fbcb9d300f80a4b24bd3368 @chipx86 chipx86 committed May 2, 2010
Showing with 2 additions and 2 deletions.
  1. +2 −2 djblets/webapi/core.py
View
4 djblets/webapi/core.py
@@ -324,7 +324,7 @@ class WebAPIResponseError(WebAPIResponse):
A general error response, containing an error code and a human-readable
message.
"""
- def __init__(self, request, err, extra_params={}, headers=None,
+ def __init__(self, request, err, extra_params={}, headers={},
*args, **kwargs):
errdata = {
'err': {
@@ -334,7 +334,7 @@ def __init__(self, request, err, extra_params={}, headers=None,
}
errdata.update(extra_params)
- headers = headers or {}
+ headers = headers.copy()
headers.update(err.headers)
WebAPIResponse.__init__(self, request, obj=errdata, stat="fail",

0 comments on commit ef1a8e0

Please sign in to comment.
Something went wrong with that request. Please try again.