Commit 833b329e authored by Damien Lespiau's avatar Damien Lespiau
Browse files

series: Add a signal to notify when a revision is complete

To decouple some high level and rather complex parsing code from the
models, let's add a signal when a SeriesRevision is complete.

One can use that signal to hook some logic there, for instance from the
mail parsing code.
Signed-off-by: default avatarDamien Lespiau <>
Acked-by: default avatarStephen Finucane <>
parent fedf571f
......@@ -19,6 +19,7 @@
from django.db import models
from django.db.models import Q
import django.dispatch
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.contrib.sites.models import Site
......@@ -454,6 +455,10 @@ class Series(models.Model):
print(' msgid : %s' % patch.msgid)
i += 1
# Signal one can listen to to know when a revision is complete (ie. has all of
# its patches)
series_revision_complete = django.dispatch.Signal(providing_args=["revision"])
# A 'revision' of a series. Resending a new version of a patch or a full new
# iteration of a series will create a new revision.
class SeriesRevision(models.Model):
......@@ -480,6 +485,10 @@ class SeriesRevision(models.Model):
revision_complete = self.patches.count() == self.series.n_patches
if revision_complete:
series_revision_complete.send(sender=self.__class__, revision=self)
def duplicate_meta(self):
new = SeriesRevision.objects.get( = None
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment