On 23-6-2012 9:52, Melvyn Sopacua wrote:
> On 23-6-2012 0:02, ydjango wrote:
>>
>> Thank you, I also believe it is Race condition. I do not want to use 
>> get_or_create as I like to have control over DB writes and updates. I will 
>> try Unique_together and catch the integrity error exception as Kurtis 
>> suggested or check again before doing save().
>>
>> or just thinking aloud, Is there a way to acquire a lock which can 
>> serialize any other requests which have same "a" and "b" values?
> 
> unique_together + transaction middleware.
> https://docs.djangoproject.com/en/1.4/topics/db/transactions/

Ok, hit send too soon. No, this doesn't give you access to other
requests as far as I can tell, but operations depending upon the insert
operation succeeding are now part of a transaction and can be handled
more gracefully inside django as well, pending the result of the
transaction.

-- 
Melvyn Sopacua


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to