Code review comment for lp://staging/~mterry/ubuntuone-couch/extra-headers

Revision history for this message
Eric Casteleijn (thisfred) wrote :

Looks good, except this is a bad idea:

+ token_secret=None, headers={}):

As default values in Python should as a rule not be mutable types. Default values are evaluated at import time, making this empty dictionary a 'global' variable, so that in this case the oauth headers for one call to request() will pollute the dictionary for any subsequent calls.

Please change it to:

+ token_secret=None, headers=None):

and then at the beginning of the function implementation do:

headers = headers or {}

Also a test case would be awesome, but if you cannot think of one, I can look at that.

review: Needs Fixing

« Back to merge proposal