Skip to content

Instantly share code, notes, and snippets.

@pauricthelodger
Last active December 16, 2015 20:10
Show Gist options
  • Save pauricthelodger/5490599 to your computer and use it in GitHub Desktop.
Save pauricthelodger/5490599 to your computer and use it in GitHub Desktop.
From https://github.com/pauricthelodger/spaceapi-server/blob/master/spaceapis.py If validate passes: 'sync' dictionary with dict.update
def validate(self, current_data, new_data):
if isinstance(new_data, dict):
return self.validate_dict(current_data, new_data)
elif isinstance(new_data, list):
return self.validate_list(current_data, new_data)
else:
return True
def sync(self, current_data, new_data):
if isinstance(new_data, dict):
return self.sync_dict(current_data, new_data)
elif isinstance(new_data, list):
return self.sync_list(current_data, new_data)
else:
return True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment