[buildinfo.debian.net] 07/07: Populate key upon creation.

Chris Lamb chris at chris-lamb.co.uk
Thu Nov 3 20:46:20 UTC 2016


This is an automated email from the git hooks/post-receive script.

lamby pushed a commit to branch master
in repository buildinfo.debian.net.

commit 007010de296320d350da0e189569676b5c39d640
Author: Chris Lamb <lamby at debian.org>
Date:   Thu Nov 3 20:46:02 2016 +0000

    Populate key upon creation.
    
    Signed-off-by: Chris Lamb <lamby at debian.org>
---
 bidb/keys/models.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/bidb/keys/models.py b/bidb/keys/models.py
index 50ffceb..9929e3b 100644
--- a/bidb/keys/models.py
+++ b/bidb/keys/models.py
@@ -1,6 +1,6 @@
 import datetime
 
-from django.db import models
+from django.db import models, transaction
 
 
 class Key(models.Model):
@@ -20,3 +20,13 @@ class Key(models.Model):
             self.uid,
             self.name,
         )
+
+    def save(self, *args, **kwargs):
+        created = not self.pk
+
+        super(Key, self).save(*args, **kwargs)
+
+        if created:
+            from .tasks import update_or_create_key
+
+            transaction.on_commit(lambda: update_or_create_key.delay(self.pk))

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/buildinfo.debian.net.git



More information about the Reproducible-commits mailing list