self._data should be self.data

master
Marek Isalski 3 years ago
parent e7a009526c
commit 3969b7f0d1

@ -159,7 +159,7 @@ class APIObject(object):
raise ValueError( raise ValueError(
"%s ID %d already created" % (self.__class__.__name__, self.id) "%s ID %d already created" % (self.__class__.__name__, self.id)
) )
self._data.update(**kwargs) self.data.update(**kwargs)
if not self._data: if not self._data:
raise ValueError("No data associated with record.") raise ValueError("No data associated with record.")
return self._create(parent=parent,data=self._data) return self._create(parent=parent,data=self._data)
@ -274,7 +274,7 @@ class Customer(APIObject):
def create(self, parent=None, **kwargs): def create(self, parent=None, **kwargs):
if parent: if parent:
raise ValueError("Customer cannot have a parent") raise ValueError("Customer cannot have a parent")
self._data.update(**kwargs) self.data.update(**kwargs)
for k in ("accountType", "company", "firstName", "lastName", "email", "address1", "city", "postcode", "telephone"): for k in ("accountType", "company", "firstName", "lastName", "email", "address1", "city", "postcode", "telephone"):
if k not in self._data: if k not in self._data:
raise ValueError('missing mandatory field "%s"' % k) raise ValueError('missing mandatory field "%s"' % k)
@ -346,7 +346,7 @@ class LinkedUser(APIObject):
def create(self, parent, **kwargs): def create(self, parent, **kwargs):
kwargs['type'] = "linkeduser" kwargs['type'] = "linkeduser"
self._data.update(**kwargs) self.data.update(**kwargs)
for k in ("activateUrl", "email", "recordingAccess", "owner", "enabled"): for k in ("activateUrl", "email", "recordingAccess", "owner", "enabled"):
if k not in self._data: if k not in self._data:
raise ValueError('missing mandatory field "%s"' % k) raise ValueError('missing mandatory field "%s"' % k)

Loading…
Cancel
Save