From 46eb453c36e742ec69fbc0442ac43245d7ee7eb7 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sun, 26 Mar 2006 15:36:43 +0000 Subject: [PATCH] column label generation checks for a conflict against a column named the same as the label comment in mapper --- lib/sqlalchemy/mapping/mapper.py | 4 ++-- lib/sqlalchemy/sql.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/sqlalchemy/mapping/mapper.py b/lib/sqlalchemy/mapping/mapper.py index 82257ae623..1efdb649a3 100644 --- a/lib/sqlalchemy/mapping/mapper.py +++ b/lib/sqlalchemy/mapping/mapper.py @@ -998,8 +998,8 @@ class MapperExtension(object): Essentially, this method is used to have a different mapper populate the object: - def populate_instance(self, mapper, *args): - othermapper.populate_instance(*args) + def populate_instance(self, mapper, instance, row, identitykey, imap, isnew): + othermapper.populate_instance(instance, row, identitykey, imap, isnew, frommapper=mapper) return False """ if self.next is None: diff --git a/lib/sqlalchemy/sql.py b/lib/sqlalchemy/sql.py index c4cb4d1486..6116a44e15 100644 --- a/lib/sqlalchemy/sql.py +++ b/lib/sqlalchemy/sql.py @@ -1024,7 +1024,7 @@ class ColumnClause(ColumnElement): self.__label = self.table.name + "_" + self.text else: self.__label = self.text - if len(self.__label) >= 30: + if (self.table is not None and self.table.c.has_key(self.__label)) or len(self.__label) >= 30: self.__label = self.__label[0:24] + "_" + hex(random.randint(0, 65535))[2:] return self.__label _label = property(_get_label) -- 2.47.2