]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- rename .attr to .attrs on mapper, instance state, [ticket:2569]
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 22 Sep 2012 19:46:09 +0000 (15:46 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 22 Sep 2012 19:46:09 +0000 (15:46 -0400)
lib/sqlalchemy/orm/mapper.py
lib/sqlalchemy/orm/state.py
test/orm/test_inspect.py

index 45124127a3011278b68fcdd965bece41e3640811..4269e332faac9be712a50dc9cce2c3dac81df3c1 100644 (file)
@@ -1492,14 +1492,14 @@ class Mapper(_InspectionAttr):
                 yield c
 
     @util.memoized_property
-    def attr(self):
+    def attrs(self):
         """A namespace of all :class:`.MapperProperty` objects
         associated this mapper.
 
         This is an object that provides each property based on
         its key name.  For instance, the mapper for a
         ``User`` class which has ``User.name`` attribute would
-        provide ``mapper.attr.name``, which would be the
+        provide ``mapper.attrs.name``, which would be the
         :class:`.ColumnProperty` representing the ``name``
         column.   The namespace object can also be iterated,
         which would yield each :class:`.MapperProperty`.
@@ -1522,7 +1522,7 @@ class Mapper(_InspectionAttr):
 
         See also:
 
-        :attr:`.Mapper.attr` - namespace of all :class:`.MapperProperty`
+        :attr:`.Mapper.attrs` - namespace of all :class:`.MapperProperty`
         objects.
 
         """
@@ -1535,7 +1535,7 @@ class Mapper(_InspectionAttr):
 
         See also:
 
-        :attr:`.Mapper.attr` - namespace of all :class:`.MapperProperty`
+        :attr:`.Mapper.attrs` - namespace of all :class:`.MapperProperty`
         objects.
 
         """
@@ -1548,7 +1548,7 @@ class Mapper(_InspectionAttr):
 
         See also:
 
-        :attr:`.Mapper.attr` - namespace of all :class:`.MapperProperty`
+        :attr:`.Mapper.attrs` - namespace of all :class:`.MapperProperty`
         objects.
 
         """
@@ -1561,7 +1561,7 @@ class Mapper(_InspectionAttr):
 
         See also:
 
-        :attr:`.Mapper.attr` - namespace of all :class:`.MapperProperty`
+        :attr:`.Mapper.attrs` - namespace of all :class:`.MapperProperty`
         objects.
 
         """
index 22ad06f13f184a21c1de2c8aa80d55ca588d41d3..0f60c6712c786e2e3963ba219171b243c37677d9 100644 (file)
@@ -49,7 +49,7 @@ class InstanceState(interfaces._InspectionAttr):
         self.committed_state = {}
 
     @util.memoized_property
-    def attr(self):
+    def attrs(self):
         """Return a namespace representing each attribute on
         the mapped object, including its current value
         and history.
index 1c5cab8a039ea2e603b5e861cb1fe4ff5f054087..bd43e43d6a82d4bc7985eca7f318da2c0e0202d3 100644 (file)
@@ -108,7 +108,7 @@ class TestORMInspection(_fixtures.FixtureTest):
     def test_property(self):
         User = self.classes.User
         insp = inspect(User)
-        is_(insp.attr.id, class_mapper(User).get_property('id'))
+        is_(insp.attrs.id, class_mapper(User).get_property('id'))
 
     def test_with_polymorphic(self):
         User = self.classes.User
@@ -119,7 +119,7 @@ class TestORMInspection(_fixtures.FixtureTest):
         User = self.classes.User
         user_table = self.tables.users
         insp = inspect(User)
-        id_prop = insp.attr.id
+        id_prop = insp.attrs.id
 
         eq_(id_prop.columns, [user_table.c.id])
         is_(id_prop.expression, user_table.c.id)
@@ -130,7 +130,7 @@ class TestORMInspection(_fixtures.FixtureTest):
         User = self.classes.User
         insp = inspect(User)
         eq_(
-            set(insp.attr.keys()),
+            set(insp.attrs.keys()),
             set(['addresses', 'orders', 'id', 'name', 'name_syn'])
         )
 
@@ -209,15 +209,15 @@ class TestORMInspection(_fixtures.FixtureTest):
         insp = inspect(u1)
 
         eq_(
-            set(insp.attr.keys()),
+            set(insp.attrs.keys()),
             set(['id', 'name', 'name_syn', 'addresses', 'orders'])
         )
         eq_(
-            insp.attr.name.value,
+            insp.attrs.name.value,
             'ed'
         )
         eq_(
-            insp.attr.name.loaded_value,
+            insp.attrs.name.loaded_value,
             'ed'
         )
 
@@ -227,17 +227,17 @@ class TestORMInspection(_fixtures.FixtureTest):
         insp = inspect(u1)
         # value was not set, NO_VALUE
         eq_(
-            insp.attr.id.loaded_value,
+            insp.attrs.id.loaded_value,
             NO_VALUE
         )
         # regular accessor sets it
         eq_(
-            insp.attr.id.value,
+            insp.attrs.id.value,
             None
         )
         # now the None is there
         eq_(
-            insp.attr.id.loaded_value,
+            insp.attrs.id.loaded_value,
             None
         )
 
@@ -247,17 +247,17 @@ class TestORMInspection(_fixtures.FixtureTest):
         insp = inspect(u1)
         # value was not set, NO_VALUE
         eq_(
-            insp.attr.addresses.loaded_value,
+            insp.attrs.addresses.loaded_value,
             NO_VALUE
         )
         # regular accessor sets it
         eq_(
-            insp.attr.addresses.value,
+            insp.attrs.addresses.value,
             []
         )
         # now the None is there
         eq_(
-            insp.attr.addresses.loaded_value,
+            insp.attrs.addresses.loaded_value,
             []
         )
 
@@ -265,12 +265,12 @@ class TestORMInspection(_fixtures.FixtureTest):
         User = self.classes.User
         u1 = User(name='ed')
         insp = inspect(u1)
-        hist = insp.attr.addresses.history
+        hist = insp.attrs.addresses.history
         eq_(
             hist.unchanged, None
         )
         u1.addresses
-        hist = insp.attr.addresses.history
+        hist = insp.attrs.addresses.history
         eq_(
             hist.unchanged, []
         )