On Aug 29, 2008, at 11:22 AM, andrew cooke wrote:
> > Hi, > > Not sure if I'm misunderstanding what's happening, whether I have a > bug, or whether this is normal behaviour, but as far as I can tell > mapped objects that are returned from a query do not have their > constructor called. Is that correct? yes. > In a bit more detail - I have a mapping defined to class Metric, and a > query() returns a Metric instance, with the correct attributes, but if > in the constructor I have something like: > > class Metric(object): > def __init__(self): > self.constructor_called = True > > then the instance returned by query does not have the > "constructor_called" attribute (my actual code is more complex, but > that's the general idea). > > Is this normal behaviour? Is there any way to get the constructor to > be called? I can work around this if not, but would liek to be sure I > am not ignoring an error of some kind. an FAQ entry on this is here: http://www.sqlalchemy.org/trac/wiki/FAQ#whyisntmy__init__calledwhenIloadobjects --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---