]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
r818@lightspeed: robert | 2006-01-12 18:32:38 +1100
authorRobert Leftwich <rtl@pobox.com>
Thu, 12 Jan 2006 07:33:28 +0000 (07:33 +0000)
committerRobert Leftwich <rtl@pobox.com>
Thu, 12 Jan 2006 07:33:28 +0000 (07:33 +0000)
 Added class name to the TypeError string to make it easier to find constructor problems when mapper is constructing complex mappings

lib/sqlalchemy/mapping/mapper.py

index a1a3ee5fb3160f31a8f8e29ad2da06be4cdfd838..ff0f1fc878536d58da766a1a733aa56b71f0e0f2 100644 (file)
@@ -215,7 +215,11 @@ class Mapper(object):
             def init(self, *args, **kwargs):
                 nohist = kwargs.pop('_mapper_nohistory', False)
                 if oldinit is not None:
-                    oldinit(self, *args, **kwargs)
+                    try:
+                        oldinit(self, *args, **kwargs)
+                    except TypeError, msg:
+                        # re-raise with the offending class name added to help in debugging
+                        raise TypeError, '%s.%s' %(self.__class__.__name__, msg)
                 if not nohist:
                     objectstore.uow().register_new(self)
             self.class_.__init__ = init