From: Kyle Stark Date: Mon, 13 Jan 2014 16:52:31 +0000 (-0800) Subject: Fix TypeError for class_mapper called w/ iterable X-Git-Tag: rel_0_9_2~59^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=58d3a4147361315fec2979e7bf933f4bd30ae46b;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Fix TypeError for class_mapper called w/ iterable 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). --- diff --git a/lib/sqlalchemy/orm/base.py b/lib/sqlalchemy/orm/base.py index e3b75eda0d..577f9ff764 100644 --- a/lib/sqlalchemy/orm/base.py +++ b/lib/sqlalchemy/orm/base.py @@ -375,7 +375,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