From 58d3a4147361315fec2979e7bf933f4bd30ae46b Mon Sep 17 00:00:00 2001 From: Kyle Stark Date: Mon, 13 Jan 2014 08:52:31 -0800 Subject: [PATCH] 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). --- lib/sqlalchemy/orm/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- 2.47.3