Also be aware that the API to populate_instance() has changed (ironically,
the very thing that I was worrying about in the thread)
Update this:
def populate_instance(self, mapper, selectcontext, row, instance,
identitykey, isnew):
if isnew:
mapper.populate_instance(selectcontext, instance, row,
identitykey, isnew)
instance.onload()
return None
return EXT_PASS
to this:
def populate_instance(self, mapper, selectcontext, row, instance,
**kwargs):
if kwargs.get('isnew') and hasattr(instance, 'onload'):
mapper.populate_instance(selectcontext, instance, row, **kwargs)
instance.onload()
return None
return EXT_CONTINUE
On Tue, Mar 25, 2008 at 12:57 PM, Michael Bayer [EMAIL PROTECTED]
wrote:
we have a new hook that will be coming soon called something like
__reconstitute__(), which will be called on instances after they've
been created and had their initial population from the result row.
Note that eagerly-loaded collections might not be fully loaded at this
stage.
at the moment the populate_instance() hook is what works in the
current version of 0.4.
On Mar 25, 2008, at 7:05 AM, Nebur wrote:
I'm going to post-populate an instance, and there's a thread which is
exactly about my question but fairly old:
http://groups.google.de/group/sqlalchemy/browse_thread/thread/7467f8e9d86b1749/
Is there a post_populate hook in the current SA 0.4.x, or is Ricks way
(using populate_instance) still the best ?
Ruben
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---