do not use empty dict in parameter default
just fixed a bug in bitmask, along these lines:
# python gotchas 101
def foobar(headers={}, thing=False):
if thing:
print "WE MODIFY HEADERS"
headers['if-modified'] = [thing]
else:
print "WE DO NOT MODIFY HEADERS"
print headers
foobar(thing=42)
foobar(thing=23)
foobar(thing=False)
there are some occurrences in soledad:
/home/user/leap/soledad/tests/test_soledad/u1db_tests/test_http_client.py
[1] 304: self.getClient, creds={})
/home/user/leap/soledad/src/leap/soledad/common/couch/support.py
[2] 52: def add(self, mimetype, content, headers={}):
/home/user/leap/soledad/src/leap/soledad/common/l2db/errors.py
[3] 146: def __init__(self, status, message=None, headers={}):
[4] 163: def __init__(self, message=None, headers={}):
/home/user/leap/soledad/src/leap/soledad/common/l2db/remote/http_app.py
[5] 456: def start_response(self, status, obj_dic=None, headers={}):
[6] 476: def send_response_json(self, status=200, headers={}, **kwargs):
[7] 481: def send_response_content(self, content, status=200, headers={}):
they might be modifying the dict or not, but I think it's safer to use Nones.