]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Fix TypeError for class_mapper called w/ iterable
authorKyle Stark <kyle@goodrx.com>
Mon, 13 Jan 2014 16:52:31 +0000 (08:52 -0800)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 15 Jan 2014 01:24:04 +0000 (20:24 -0500)
When the class_ passed is not a mapped class but is actually an iterable, the string formatting operation fails with a TypeError, and the expected ArgumentError is not raised. Calling code which is using reflection and expects this error will fail (e.g. the sadisplay module).
Conflicts:
lib/sqlalchemy/orm/base.py

lib/sqlalchemy/orm/util.py

index cc2751f2e2b3421602aed7a16032847052481e30..b7abf49315fb7fc1fc0d705fecadf49f266a256b 100644 (file)
@@ -1147,7 +1147,7 @@ def class_mapper(class_, configure=True):
     if mapper is None:
         if not isinstance(class_, type):
             raise sa_exc.ArgumentError(
-                    "Class object expected, got '%r'." % class_)
+                    "Class object expected, got '%r'." % (class_, ))
         raise exc.UnmappedClassError(class_)
     else:
         return mapper