From d97ee85ca8e4f7b53f759a411c0c9c87cb987a64 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sat, 17 Jun 2006 14:57:10 +0000 Subject: [PATCH] try/except around init.__name__ = oldinit.__name__ for py2.3 compat --- CHANGES | 4 ++++ lib/sqlalchemy/orm/mapper.py | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 5bcbda4d73..93727226a1 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +0.2.4 +- try/except when the mapper sets init.__name__ on a mapped class, +supports python 2.3 + 0.2.3 - overhaul to mapper compilation to be deferred. this allows mappers to be constructed in any order, and their relationships to each diff --git a/lib/sqlalchemy/orm/mapper.py b/lib/sqlalchemy/orm/mapper.py index ac8d6f330f..2d118e9e56 100644 --- a/lib/sqlalchemy/orm/mapper.py +++ b/lib/sqlalchemy/orm/mapper.py @@ -477,8 +477,12 @@ class Mapper(object): # override oldinit, insuring that its not already a Mapper-decorated init method if oldinit is None or not hasattr(oldinit, '_sa_mapper_init'): init._sa_mapper_init = True - init.__name__ = oldinit.__name__ - init.__doc__ = oldinit.__doc__ + try: + init.__name__ = oldinit.__name__ + init.__doc__ = oldinit.__doc__ + except: + # cant set __name__ in py 2.3 ! + pass self.class_.__init__ = init mapper_registry[self.class_key] = self if self.entity_name is None: -- 2.47.3