188
188
self._manager.load_object(self)
190
190
def put(self, expected_value=None):
192
Save this object as it is, with an optional expected value
194
:param expected_value: Optional tuple of Attribute, and Value that
195
must be the same in order to save this object. If this
196
condition is not met, an SDBResponseError will be raised with a
198
:type expected_value: tuple or list
200
:rtype: :class:`boto.sdb.db.model.Model`
191
202
self._manager.save_object(self, expected_value)
207
def put_attributes(self, attrs):
209
Save just these few attributes, not the whole object
211
:param attrs: Attributes to save, key->value dict
214
:rtype: :class:`boto.sdb.db.model.Model`
216
assert(isinstance(attrs, dict)), "Argument must be a dict of key->values to save"
217
for prop_name in attrs:
218
value = attrs[prop_name]
219
prop = self.find_property(prop_name)
220
assert(prop), "Property not found: %s" % prop_name
221
self._manager.set_property(prop, self, prop_name, value)
225
def delete_attributes(self, attrs):
227
Delete just these attributes, not the whole object.
229
:param attrs: Attributes to save, as a list of string names
232
:rtype: :class:`boto.sdb.db.model.Model`
234
assert(isinstance(attrs, list)), "Argument must be a list of names of keys to delete."
235
self._manager.domain.delete_attributes(self.id, attrs)
239
save_attributes = put_attributes
195
241
def delete(self):
196
242
self._manager.delete_object(self)