Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Commit

Permalink
Merge pull request #543 from pjenvey/fix/541
Browse files Browse the repository at this point in the history
fix: kill mutable default arguments
  • Loading branch information
bbangert authored Jul 22, 2016
2 parents 5c6cb3c + b405cce commit f6177f7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions autopush/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ class InvalidTokenException(Exception):
class InvalidRequest(AutopushException):
"""Invalid request exception, may include custom status_code and message
to write for the error"""
def __init__(self, message, status_code=400, errno=None, headers={}):
def __init__(self, message, status_code=400, errno=None, headers=None):
super(AutopushException, self).__init__(message)
self.status_code = status_code
self.errno = errno
self.headers = headers
self.headers = {} if headers is None else headers
8 changes: 4 additions & 4 deletions autopush/router/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ class RouterException(AutopushException):
"""
def __init__(self, message, status_code=500, response_body="",
router_data=None, headers={}, log_exception=True,
router_data=None, headers=None, log_exception=True,
errno=None, logged_status=None):
"""Create a new RouterException"""
super(AutopushException, self).__init__(message)
self.status_code = status_code
self.headers = headers
self.headers = {} if headers is None else headers
self.log_exception = log_exception
self.response_body = response_body or message
self.errno = errno
Expand All @@ -29,12 +29,12 @@ class RouterResponse(object):
"""
def __init__(self, status_code=200, response_body="", router_data=None,
headers={}, errno=None, logged_status=None):
headers=None, errno=None, logged_status=None):
"""Create a new RouterResponse"""
self.status_code = status_code
self.response_body = response_body
self.router_data = router_data
self.headers = headers
self.headers = {} if headers is None else headers
self.errno = errno
self.logged_status = logged_status

Expand Down
6 changes: 4 additions & 2 deletions autopush/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def __init__(self,
endpoint_scheme=None,
endpoint_hostname=None,
endpoint_port=None,
router_conf={},
router_conf=None,
router_tablename="router",
router_read_throughput=5,
router_write_throughput=5,
Expand All @@ -84,7 +84,7 @@ def __init__(self,
wake_timeout=0,
env='development',
enable_cors=False,
senderid_list={},
senderid_list=None,
hello_timeout=0,
bear_hash_key=None,
preflight_uaid="deadbeef00000000deadbeef000000000",
Expand Down Expand Up @@ -138,6 +138,8 @@ def __init__(self,
self.endpoint_hostname = endpoint_hostname or self.hostname
self.router_hostname = router_hostname or self.hostname

if router_conf is None:
router_conf = {}
self.router_conf = router_conf
self.router_url = canonical_url(
router_scheme or 'http',
Expand Down

0 comments on commit f6177f7

Please sign in to comment.