Commits

Jean-Tiare Le Bigot committed 080bb45 Merge

merge bug fix #11 from 1.6.3 to 1.7.0

Comments (0)

Files changed (4)

 ce23d59bbbc2361d8db0f1362aca4f552c7120cc 1.6.0
 ebfa3e966160a3cb027438100f5270126a5ce535 1.6.1
 34934595a8c35bfe8e044a1d4f48294db4de5881 1.6.2
+739db7a1b75fd3ebe599468051821714db2e304a 1.6.3
     - ``to_db_dict`` should be replaced by ``to_json_dict``
     - overloading for custom DB Item (de-)serialization can still be done provided that the function is renamed
 
+
+====================
+DynamoDBMapper 1.6.3
+====================
+
+This section documents all user visible changes included between DynamoDBMapper
+versions 1.6.2 and versions 1.6.3
+
+Changes
+-------
+
+- fix bug #11 in delete. Keys where not serialized.
+
+
 ====================
 DynamoDBMapper 1.6.2
 ====================

dynamodb_mapper/model.py

         schema = cls.__schema__
         expected_values = None
         hash_key_value = getattr(self, cls.__hash_key__)
+        h_value = _python_to_dynamodb(hash_key_value)
 
         if raise_on_conflict:
             if self._raw_data:
         # Range key is only present in composite primary keys
         if cls.__range_key__:
             range_key_value = getattr(self, cls.__range_key__)
+            r_value = _python_to_dynamodb(range_key_value)
         else:
-            range_key_value = None
+            r_value = None
 
         try:
             table = ConnectionBorg().get_table(cls.__table__)
-            Item(table, hash_key_value, range_key_value).delete(expected_values)
+            Item(table, h_value, r_value).delete(expected_values)
         except DynamoDBConditionalCheckFailedError, e:
             raise ConflictError(e)
 
         # Make sure any further save will be considered as *insertion*
         self._raw_data = {}
 
-        dblog.debug("Deleted (%s, %s) from table %s", hash_key_value, range_key_value, cls.__table__)
+        dblog.debug("Deleted (%s, %s) from table %s", h_value, r_value, cls.__table__)

dynamodb_mapper/tests/test_model.py

         m_item_instance = m_item.return_value
         m_table = m_boto.connect_dynamodb.return_value.get_table.return_value
 
+        python_date = datetime.datetime(2012, 05, 31, 12, 0, 0, tzinfo=utc_tz)
+        dynamodb_date = _python_to_dynamodb(python_date)
+
         raw_data = {
-            u"id":42
+            u"datetime":dynamodb_date
         }
 
         # Simulate obj from DB
-        d = DoomEpisode._from_db_dict(raw_data)
+        d = Patch._from_db_dict(raw_data)
 
         d.delete()
 
         self.assertEquals(d._raw_data, {})
-        m_item.assert_called_once_with(m_table, 42, None)
+        m_item.assert_called_once_with(m_table, dynamodb_date, None)
         assert m_item_instance.delete.called
 
     @mock.patch("dynamodb_mapper.model.boto")