1
0
Parcourir la source

Fix, raising exception in atomic block don't commit it.

Fabs il y a 11 ans
Parent
commit
3362574ee8
1 fichiers modifiés avec 1 ajouts et 4 suppressions
  1. 1 4
      coin/models.py

+ 1 - 4
coin/models.py

@@ -18,7 +18,7 @@ class CoinLdapSyncModel(models.Model):
         raise NotImplementedError('Using CoinLdapSyncModel require '
         raise NotImplementedError('Using CoinLdapSyncModel require '
                                   'sync_to_ldap method being implemented')
                                   'sync_to_ldap method being implemented')
 
 
-    #@transaction.commit_manually
+    @transaction.atomic
     def save(self, *args, **kwargs):
     def save(self, *args, **kwargs):
         # Détermine si on est dans une création ou une mise à jour
         # Détermine si on est dans une création ou une mise à jour
         creation = (self.pk == None)
         creation = (self.pk == None)
@@ -32,10 +32,7 @@ class CoinLdapSyncModel(models.Model):
         try:
         try:
             self.sync_with_ldap(creation)
             self.sync_with_ldap(creation)
         except:
         except:
-            #transaction.rollback()
             raise
             raise
-        else:
-            #transaction.commit()
 
 
     class Meta:
     class Meta:
         abstract = True
         abstract = True