[PATCH 08/15] series: Create Series objects when parsing mails
Damien Lespiau
damien.lespiau at intel.com
Mon Oct 19 22:23:29 AEDT 2015
On Sat, Oct 10, 2015 at 12:21:17AM +0100, Finucane, Stephen wrote:
> > +# The complexity here is because patches can be received out of order:
> > +# If we receive a patch, part of series, before the root message, we
> > create a
> > +# placeholder series that will be updated once we receive the root
> > message.
> > +def find_series_for_mail(project, name, msgid, refs):
> > + if refs == []:
> > + root_msgid = msgid
> > + else:
> > + root_msgid = refs[-1]
> > +
> > + try:
> > + revision = SeriesRevision.objects.get(root_msgid = root_msgid)
> > + series = revision.series
> > + if name:
> > + series.name = name
> > + except SeriesRevision.DoesNotExist:
> > + if not name:
> > + name = "Untitled series"
>
> Nope. This is a lie as the name of the series is not 'Untitled
> series': it's None (i.e. nothing). The model needs to be updated to
> allow 'null' names and this 'Untitled series' string should be
> generated in the UI.
I went back and forth on this. Making the string part of the client code
instead of having a stronger invariant "all series have a name" make
things harder: special handling in all clients (web site, but also
command line clients), special handling when editing (I have further
work allowing people to edit their series name through the web UI), ...
The real thing I could find to leave the string outside of the DB is for
i18n, but I have no intention to go there.
--
Damien
More information about the Patchwork
mailing list