> Could you explain how this works, please?
>
> It looks - to my uneducated eyes - if this leaves open a potential race
> condition where the mtime field could yet be changed in the database by
> another process within the "decision time" of this method. Do I
> misunderstand? It seems to me that this can only be reliably caught by
> the database itself (probably using a rule or trigger).
>
> Thanks,
> Michael

t=time p=process

t1 p1 read mtime
t2 p2 read mtime
t3 p2 write mtime
t4 p1 write mtime

AFAIK the database should raise an exception. 

Process1 does a 'dirty read':

http://www.postgresql.org/docs/8.2/static/transaction-iso.html

But you need to use transaction management. The read and write
must be in one transaction.

The edit form has hidden value which contains the current mtime of the model
instance. If the form is valid, check if the mtime has not changed. If it
changed, you need reload the form (All previous form input must be reset,
otherwise the user can't see what the other person has changed).

HTH,
 Thomas

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to