this ones big, i can handle it. the attached patch makes your case work, but the problem represented here still makes itself apparent in other ways and I havent strength tested this patch. you might want to see if this patch works in all of your test cases.
--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---
Index: lib/sqlalchemy/orm/query.py =================================================================== --- lib/sqlalchemy/orm/query.py (revision 5405) +++ lib/sqlalchemy/orm/query.py (working copy) @@ -1647,7 +1647,8 @@ self.entities = [entity] self.entity_zero = entity - + self._has_polymorphic_selectable = False + def setup_entity(self, entity, mapper, adapter, from_obj, is_aliased_class, with_polymorphic): self.mapper = mapper self.extension = self.mapper.extension @@ -1668,6 +1669,7 @@ mappers, from_obj = self.mapper._with_polymorphic_args(cls_or_mappers, selectable) self._with_polymorphic = mappers + self._has_polymorphic_selectable = bool(from_obj) # TODO: do the wrapped thing here too so that with_polymorphic() can be # applied to aliases @@ -1748,7 +1750,7 @@ if adapter: context.order_by = adapter.adapt_list(util.to_list(context.order_by)) - for value in self.mapper._iterate_polymorphic_properties(self._with_polymorphic): + for value in self.mapper._iterate_polymorphic_properties(self._with_polymorphic, self._has_polymorphic_selectable): if query._only_load_props and value.key not in query._only_load_props: continue value.setup( Index: lib/sqlalchemy/orm/mapper.py =================================================================== --- lib/sqlalchemy/orm/mapper.py (revision 5406) +++ lib/sqlalchemy/orm/mapper.py (working copy) @@ -862,18 +862,20 @@ @property def _default_polymorphic_properties(self): - return util.unique_list( + return iter(util.unique_list( chain(*[list(mapper.iterate_properties) for mapper in [self] + self._with_polymorphic_mappers]) - ) - - def _iterate_polymorphic_properties(self, mappers=None): - if mappers is None: - return iter(self._default_polymorphic_properties) + )) + + def _iterate_polymorphic_properties(self, mappers=None, has_selectable=False): + if has_selectable or (self.with_polymorphic and self.with_polymorphic[1]): + return self.iterate_properties + elif mappers is None: + return self._default_polymorphic_properties else: return iter(util.unique_list( chain(*[list(mapper.iterate_properties) for mapper in [self] + mappers]) )) - + @property def properties(self): raise NotImplementedError("Public collection of MapperProperty objects is "
On Dec 3, 2008, at 9:22 AM, Gaetan de Menten wrote: > > On Wed, Dec 3, 2008 at 15:03, Michael Bayer > <[EMAIL PROTECTED]> wrote: > >> um yeah, actually this behavior is affecting all multi-level usage of >> "polymorphic_union". So, while polymorphic_union is quite obviously >> (since nobody has noticed this pretty glaring issue) on the decline >> in >> the 0.5 series, this is quite severe and ill try to have a look at it >> today. > > Do you want a bug report for this? > > -- > Gaƫtan de Menten > http://openhex.org > > --~--~---------~--~----~------------~-------~--~----~ > You received this message because you are subscribed to the Google > Groups "sqlalchemy" group. > To post to this group, send email to sqlalchemy@googlegroups.com > To unsubscribe from this group, send email to [EMAIL PROTECTED] > For more options, visit this group at > http://groups.google.com/group/sqlalchemy?hl=en > -~----------~----~----~----~------~----~------~--~--- >