On 30/05/2006, at 4:43 PM, Shaun Cutts wrote:

>
> Ian,
>
> Thanks. Your code looks concise, but a bit mysterious (maybe it's  
> the time
> of night). Is this a way to get extra events triggered in a db  
> transaction,
> or is it just inside a single web request?
>
just inside a single web request.
have a look at
models/base.py  def save()

it does...

signal the pre-save's
do the actual save
call         transaction.commit_unless_managed()
signals the post_save



> As far as I can tell, you don't seem to be insisting on having one
> transaction; if you are, are you using psychopg backend? How is it  
> able to
> get the ids of previously created objects (in the same  
> transaction)? I'd
> assumed you needed to pre-increment the sequence to generate a new  
> id by
> hand, then plug this value in on insert.
nope.. I'm not caring.. but I could be easily enough by putting my  
logic where I actually call the save() function.
>
> Ah -- ok, in your case you may be in one transaction, but you don't  
> need the
> id of the thing created (witness: if instance.id == None: ... :))

i'm doing it pre-save.. and I need to determine if it is a new record  
or not.
if I hooked the function to the post-save I would have got the 'id'  
field, but I don't think I could determine if it was a
new record or not.

>
> Some background: I'm trying to automate bulk load of data from web- 
> crawlers.
> These loads happen often enough that, if I don't enforce atomicity,  
> I'll
> have a good chance of ending up with a mess in the db when one gets
> interrupted for some random reason.
>
understood... you should try and use the post-save with transactions  
I'm guessing.

regards
ian
> - Shaun
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers
-~----------~----~----~----~------~----~------~--~---

Reply via email to