Diego Búrigo Zacarão  committed 092f129

Ensuring a RLStats object always exists when creating a lock

  • Participants
  • Parent commits e4c6c83

Comments (0)

Files changed (1)

File transifex/addons/locks/

             lock.expires = expires
         except Lock.DoesNotExist:
             # Lock didn't exist, create one
-            rlstats = RLStats.objects.get(resource=resource, language=language)
+            rlstats, created = RLStats.objects.get_or_create(resource=resource, 
+                language=language)
             lock = self.create(rlstats=rlstats, owner=user, expires=expires)
         # Set notified flag to False meaning that expiration notification
         # has not been sent about this lock yet