Skip to content

Commit

Permalink
Merge pull request #61 from gadventures/partial-update-fix
Browse files Browse the repository at this point in the history
Use deepcopy to avoid references between data and _raw_data
  • Loading branch information
bartek committed Feb 8, 2017
2 parents d8083af + 8f45244 commit a99539e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions gapipy/models/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sys
from copy import deepcopy
from decimal import Decimal
try:
# Python 2
Expand Down Expand Up @@ -41,11 +42,11 @@ class BaseModel(object):

def __init__(self, data, client):
self._client = client
self._raw_data = data
self._raw_data = deepcopy(data)
self._fill_fields(data)

def _fill_fields(self, data):
self._raw_data = data
self._raw_data = deepcopy(data)
first = lambda l: [pair[0] for pair in l]

# Initially we populate base fields, as model/resource fields may rely
Expand Down

0 comments on commit a99539e

Please sign in to comment.