Permalink
Browse files

Updated sdbmanager to encode the expected_value

  • Loading branch information...
1 parent a0d0f25 commit 4d5a732f0570dcc7b9c2f7ae5ca8856ba6e91e00 @kopertop kopertop committed Apr 8, 2011
Showing with 7 additions and 0 deletions.
  1. +7 −0 boto/sdb/db/manager/sdbmanager.py
@@ -628,6 +628,13 @@ def save_object(self, obj, expected_value=None):
raise SDBPersistenceError("Error: %s must be unique!" % property.name)
except(StopIteration):
pass
+ # Convert the Expected value to SDB format
+ if expected_value:
+ prop = obj.find_property(expected_value[0])
+ v = expected_value[1]
+ if v is not None and not type(v) == bool:
+ v = self.encode_value(prop, v)
+ expected_value[1] = v
self.domain.put_attributes(obj.id, attrs, replace=True, expected_value=expected_value)
if len(del_attrs) > 0:
self.domain.delete_attributes(obj.id, del_attrs)

0 comments on commit 4d5a732

Please sign in to comment.