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

Commit

Permalink
Merge remote-tracking branch 'origin' into feat/517
Browse files Browse the repository at this point in the history
  • Loading branch information
jrconlin committed Jul 22, 2016
2 parents b06c6a7 + f6177f7 commit 67bec82
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 13 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ ADD . /app
WORKDIR /app

RUN \
apt-get update && \
apt-get install -y -qq libexpat1-dev gcc libssl-dev libffi-dev && \
make clean && \
pip install -r pypy-requirements.txt && \
Expand Down
1 change: 1 addition & 0 deletions Dockerfile.python27
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ COPY . /app
WORKDIR /app

RUN \
apt-get update && \
apt-get install -y -qq libexpat1-dev gcc libssl-dev libffi-dev && \
make clean && \
pip install -r requirements.txt && \
Expand Down
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
8 changes: 3 additions & 5 deletions autopush/tests/test_websocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -1261,11 +1261,9 @@ def raise_exception(*args, **kwargs):

def wait_for_times(): # pragma: nocover
if len(self.proto.log.failure.mock_calls) > 0:
try:
eq_(len(self.proto.log.failure.mock_calls), 1)
finally:
d.callback(True)
return
eq_(len(self.proto.log.failure.mock_calls), 1)
d.callback(True)
return
reactor.callLater(0.1, wait_for_times)

reactor.callLater(0.1, wait_for_times)
Expand Down

0 comments on commit 67bec82

Please sign in to comment.