]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- Reworded the exception raised when a flush
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 28 Mar 2011 01:06:32 +0000 (21:06 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 28 Mar 2011 01:06:32 +0000 (21:06 -0400)
is attempted of a subclass that is not polymorphic
against the supertype.  [ticket:2063]

CHANGES
lib/sqlalchemy/orm/dependency.py

diff --git a/CHANGES b/CHANGES
index 5ec0dae420d22ec4eba00f8b2071cb656279aa59..2562f69fda18cb736c656ec6873705af02d7d11d 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -29,6 +29,11 @@ CHANGES
       are noted as are if any differences in 
       implementation/behavior are present.
 
+- orm
+  - Reworded the exception raised when a flush
+    is attempted of a subclass that is not polymorphic
+    against the supertype.  [ticket:2063]
+
 - sql
   - Restored the "catchall" constructor on the base
     TypeEngine class, with a deprecation warning.
index 5dddd02dda9c64862db3b9e38ef0362de2b14cfe..023b3e07e27caeb20357e099a13fb01fca065e3a 100644 (file)
@@ -251,14 +251,21 @@ class DependencyProcessor(object):
             not self.mapper._canload(state, 
                             allow_subtypes=not self.enable_typechecks):
             if self.mapper._canload(state, allow_subtypes=True):
-                raise exc.FlushError(
-                "Attempting to flush an item of type %s on collection '%s', "
-                "which is not the expected type %s.  Configure mapper '%s' "
-                "to load this subtype polymorphically, or set "
-                "enable_typechecks=False to allow subtypes. "
-                "Mismatched typeloading may cause bi-directional "
-                "relationships (backrefs) to not function properly." % 
-                (state.class_, self.prop, self.mapper.class_, self.mapper))
+                raise exc.FlushError('Attempting to flush an item of type '
+                                '%(x)s as a member of collection '
+                                '"%(y)s". Expected an object of type '
+                                '%(z)s or a polymorphic subclass of '
+                                'this type. If %(x)s is a subclass of '
+                                '%(z)s, configure mapper "%(zm)s" to '
+                                'load this subtype polymorphically, or '
+                                'set enable_typechecks=False to allow '
+                                'any subtype to be accepted for flush. '
+                                 % {
+                    'x': state.class_,
+                    'y': self.prop,
+                    'z': self.mapper.class_,
+                    'zm': self.mapper,
+                    })
             else:
                 raise exc.FlushError(
                 "Attempting to flush an item of type %s on collection '%s', "