changeset 13:adc90500600b

use sqla's inserted_primary_key[0] rather than deprecated last_inserted_ids()[0] see also http://www.sqlalchemy.org/docs/core/connections.html#sqlalchemy.engine.base.ResultProxy.inserted_primary_key
author MattMaker <trip@entropyreductionservices.com>
date Mon, 21 Feb 2011 17:28:29 -0600
parents 6c54b77ab174
children 1b53187ab3ed b78b2a36947c
files MoinMoin/storage/backends/indexing.py MoinMoin/util/kvstore.py
diffstat 2 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/storage/backends/indexing.py	Mon Feb 21 04:21:59 2011 +0100
+++ b/MoinMoin/storage/backends/indexing.py	Mon Feb 21 17:28:29 2011 -0600
@@ -263,7 +263,7 @@
         item_id = self.get_item_id(uuid)
         if item_id is None:
             res = item_table.insert().values(uuid=uuid, name=name).execute()
-            item_id = res.last_inserted_ids()[0]
+            item_id = res.inserted_primary_key[0]
         self.item_kvstore.store_kv(item_id, metas)
         return item_id
 
@@ -314,7 +314,7 @@
         else:
             dt = datetime.datetime.utcfromtimestamp(timestamp)
             res = rev_table.insert().values(revno=revno, item_id=item_id, datetime=dt).execute()
-            rev_id = res.last_inserted_ids()[0]
+            rev_id = res.inserted_primary_key[0]
 
         self.rev_kvstore.store_kv(rev_id, metas)
 
--- a/MoinMoin/util/kvstore.py	Mon Feb 21 04:21:59 2011 +0100
+++ b/MoinMoin/util/kvstore.py	Mon Feb 21 17:28:29 2011 -0600
@@ -150,7 +150,7 @@
                    wanted_value_type, value_type, name, value)
         else:
             res = key_table.insert().values(name=name, value_type=value_type).execute()
-            key_id = res.last_inserted_ids()[0]
+            key_id = res.inserted_primary_key[0]
         return key_id
 
     def _get_value_id(self, value):
@@ -166,7 +166,7 @@
             value_id = result[0]
         else:
             res = value_table.insert().values(value=value).execute()
-            value_id = res.last_inserted_ids()[0]
+            value_id = res.inserted_primary_key[0]
         return value_id
 
     def _associate(self, ref_id, key_id, value_id):