Permalink
Browse files

Blerg.

  • Loading branch information...
1 parent 4f5e7ad commit 79b17f017d17b5ab4af14dbfd159fcbffb15b2da @plasticine committed Feb 9, 2012
Showing with 13 additions and 13 deletions.
  1. +1 −0 apps/build/__init__.py
  2. +0 −11 apps/build/models/build.py
  3. +12 −0 apps/build/signals.py
  4. +0 −2 requirements.pip
View
@@ -0,0 +1 @@
+import signals
View
@@ -1,5 +1,4 @@
import datetime
-import hashlib
from django.db import models
from django.core.urlresolvers import reverse
@@ -44,13 +43,3 @@ def get_absolute_url(self):
'name_slug':self.project.name_slug,
'refspec':self.target.refspec
})
-
- def save(self, *args, **kwargs):
- """
- Call save twice here so we can access the build id once it has been
- created. :/
- """
- super(Build, self).save(*args, **kwargs)
- self.uuid = hashlib.sha224("%s:%s:%s" % (self.project, self.target,
- self.id)).hexdigest()[:7]
- super(Build, self).save(*args, **kwargs)
View
@@ -0,0 +1,12 @@
+import hashlib
+from django.dispatch import receiver
+from django.db.models.signals import post_save
+
+from .models import Build
+
+@receiver(post_save, sender=Build)
+def set_uuid_for_build(sender, **kwargs):
+ if kwargs.get('created') == True:
+ obj = kwargs['instance']
+ obj.uuid = hashlib.sha224("%s:%s:%s" % (obj.project, obj.target, obj.id)).hexdigest()[:7]
+ obj.save()
View
@@ -9,6 +9,4 @@ gunicorn==0.13.4
psycopg2==2.4.1
nose==1.1.2
behave==1.0.0
-requests==0.8.3
-django-piston==0.2.3
django-supervisor==0.2.4

0 comments on commit 79b17f0

Please sign in to comment.