]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
removed methods instance_key(), identity_key(), identity()
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 23 Jul 2007 22:44:12 +0000 (22:44 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 23 Jul 2007 22:44:12 +0000 (22:44 +0000)
lib/sqlalchemy/orm/mapper.py
lib/sqlalchemy/orm/query.py
lib/sqlalchemy/orm/unitofwork.py
test/orm/unitofwork.py

index 555c1990e55fcb54519616b6ea3a3e55e22d9030..62b4d7d8960e13625058c1647af09bd2289e1285 100644 (file)
@@ -1044,21 +1044,6 @@ class Mapper(object):
         else:
             return instance.__class__ is self.class_
         
-    def instance_key(self, instance):
-        """Deprecated. A synonym for `identity_key_from_instance`."""
-
-        return self.identity_key_from_instance(instance)
-
-    def identity_key(self, primary_key):
-        """Deprecated. A synonym for `identity_key_from_primary_key`."""
-
-        return self.identity_key_from_primary_key(primary_key)
-
-    def identity(self, instance):
-        """Deprecated. A synoynm for `primary_key_from_instance`."""
-
-        return self.primary_key_from_instance(instance)
-
     def _getpropbycolumn(self, column, raiseerror=True):
         try:
             prop = self.columntoproperty[column]
@@ -1080,7 +1065,6 @@ class Mapper(object):
         prop = self._getpropbycolumn(column, raiseerror)
         if prop is None:
             return NO_ATTRIBUTE
-        #print "get column attribute '%s' from instance %s" % (column.key, mapperutil.instance_str(obj))
         return prop.getattr(obj, column)
 
     def set_attr_by_column(self, obj, column, value):
@@ -1127,7 +1111,7 @@ class Mapper(object):
             # and another instance with the same identity key already exists as persistent.  convert to an
             # UPDATE if so.
             mapper = object_mapper(obj)
-            instance_key = mapper.instance_key(obj)
+            instance_key = mapper.identity_key_from_instance(obj)
             is_row_switch = not postupdate and not has_identity(obj) and instance_key in uowtransaction.uow.identity_map
             if is_row_switch:
                 existing = uowtransaction.uow.identity_map[instance_key]
@@ -1157,7 +1141,7 @@ class Mapper(object):
                 mapper = object_mapper(obj)
                 if table not in mapper.tables or not mapper._has_pks(table):
                     continue
-                instance_key = mapper.instance_key(obj)
+                instance_key = mapper.identity_key_from_instance(obj)
                 if self.__should_log_debug:
                     self.__log_debug("save_obj() table '%s' instance %s identity %s" % (table.name, mapperutil.instance_str(obj), str(instance_key)))
 
@@ -1654,7 +1638,7 @@ class Mapper(object):
         def post_execute(instance, **flags):
             self.__log_debug("Post query loading instance " + mapperutil.instance_str(instance))
 
-            identitykey = self.instance_key(instance)
+            identitykey = self.identity_key_from_instance(instance)
 
             params = {}
             for c in param_names:
index a774ce077889f6989da3329475bbeed64841b787..216a1e7b4e6838e544145b746352e013e7a3b8fb 100644 (file)
@@ -78,7 +78,7 @@ class Query(object):
         if hasattr(ident, '__colset__'):
             ident = ident.__colset__()
 
-        key = self.mapper.identity_key(ident)
+        key = self.mapper.identity_key_from_primary_key(ident)
         return self._get(key, ident, **kwargs)
 
     def load(self, ident, **kwargs):
@@ -95,7 +95,7 @@ class Query(object):
         ret = self._extension.load(self, ident, **kwargs)
         if ret is not mapper.EXT_PASS:
             return ret
-        key = self.mapper.identity_key(ident)
+        key = self.mapper.identity_key_from_primary_key(ident)
         instance = self._get(key, ident, reload=True, **kwargs)
         if instance is None:
             raise exceptions.InvalidRequestError("No instance found for identity %s" % repr(ident))
index 46770b52112f1d9fcdf91caed3b5fc7026740e25..3f41d3f35b61aa0a4b8bb3c01d1371901016ebce 100644 (file)
@@ -134,7 +134,7 @@ class UnitOfWork(object):
             self.new.remove(obj)
         if not hasattr(obj, '_instance_key'):
             mapper = object_mapper(obj)
-            obj._instance_key = mapper.instance_key(obj)
+            obj._instance_key = mapper.identity_key_from_instance(obj)
         if hasattr(obj, '_sa_insert_order'):
             delattr(obj, '_sa_insert_order')
         self.identity_map[obj._instance_key] = obj
index eb39549eeacd9e6d8aaec56502f81c865908e894..ae626db849cce57ebc4e0c060fab29ea5104260d 100644 (file)
@@ -932,8 +932,7 @@ class SaveTest(UnitOfWorkTest):
         u.email = 'multi@test.org'
 
         ctx.current.flush()
-        id = m.identity(u)
-        print id
+        id = m.primary_key_from_instance(u)
 
         ctx.current.clear()
         
@@ -1409,7 +1408,6 @@ class ManyToManyTest(UnitOfWorkTest):
         k.user_name = 'keyworduser'
         k.keyword_name = 'a keyword'
         ctx.current.flush()
-        print m.instance_key(k)
         
         id = (k.user_id, k.keyword_id)
         ctx.current.clear()