Fix issues with successive calls to .create() or .update() on resources.
Review Request #5269 — Created Jan. 16, 2014 and submitted
Fix issues with successive calls to
.create()
or.update()
on resources.The create and update methods had a parameter
data
which had a default value
of{}
. In the body of these methods, we useddata.update(...)
, which would
write to that default value. This means that successive calls would include
data that wasn't intended.This was hit when using 'rbt post -u CLN' to update a public review request
with a perforce repository. We'd update the review request resource with
'changenum', and then try to update the draft with 'public', but that would end
up also sending 'changenum' to the draft resource, which doesn't have that
attribute.
Reproduced the case in the bug. After this fix, I can use 'rbt post -u CLN' to
update and publish a review request all in one go.
Description | From | Last Updated |
---|---|---|
Blank line between. |
SM smacleod |
-
Just a couple nits. Ship-It with the updated spacing and your call on the dict updating.
-
This fixes the current bug, but also modifies the dictionary passed into data.
Maybe we should switch to:
if data in None:
data = {}kwargs.update(data) for name, value in kwargs.iteritems(): ...
I'll leave if up to you to decide if we want the passed in dict to be modified.
-