[damned-lies] Reactivate roles at each action (instead of 'Upload translation' only)



commit b09d5d986000dbbd83e305c1fd55aa06b4dd5cc0
Author: Claude Paroz <claude 2xlibre net>
Date:   Thu Mar 31 14:25:06 2011 +0200

    Reactivate roles at each action (instead of 'Upload translation' only)

 vertimus/models.py |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/vertimus/models.py b/vertimus/models.py
index f172c49..89a9bbe 100644
--- a/vertimus/models.py
+++ b/vertimus/models.py
@@ -494,6 +494,15 @@ class ActionAbstract(object):
             self._action_db.file.save(file.name, file, save=False)
         self._action_db.save()
 
+        # Reactivating the role if needed
+        try:
+            role = person.role_set.get(team=state.language.team)
+            if not role.is_active:
+                role.is_active = True
+                role.save()
+        except Role.DoesNotExist:
+            pass
+
     def __unicode__(self):
         return unicode(self.description) # needs unicode() because description is lazy
 
@@ -632,13 +641,6 @@ class ActionUT(ActionAbstract):
 
         new_state = self._new_state()
         self.send_mail_new_state(state, new_state, (state.language.team.mailing_list,))
-
-        # Reactivating the role if needed      
-        role = Role.objects.get(person=person, team=state.language.team)
-        if not role.is_active:
-            role.is_active = True
-            role.save()
-
         return new_state
 
 class ActionRP(ActionAbstract):



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]