Phillip J. Eby wrote: > I just noticed that in the latest version of the branch, there's a > new_instance() call that is using a class' __new__ method in order to > create a new instance, rather than using 'class()'. What I'd like to > find out is how to get around this, because Trellis objects will not > be properly initialized unless the 'class()' is called, with any > initialization taking place inside __new__ and/or __init__. Trellis > doesn't override __new__ or __init__, and doesn't care what they > do. But the creation of an instance *must* be wrapped by the class' > __call__ (i.e. class()), as there is a try/finally involved that must execute. > > Any thoughts on how this might be refactored? What is new_instance() used > for?
new_instance creates an instance without invoking __init__. The ORM uses it to recreate instances when loading from the database. new_instance can be added to InstrumentationManager as an extension method... The ORM doesn't care how empty instances are manufactured so long as they can be created without initialization arguments, e.g. a no-arg constructor. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---