• Damien Lespiau's avatar
    patch: Make the /patch/msgid/ view resilient to duplicate msgids · d8a74c39
    Damien Lespiau authored
    In case of cross posting on mailing-lists handled by patchwork we have
    duplicated msgids in the DB. So we need to make a choice when asked for
    the patch with a give msgid. Otherwise:
    Internal Server Error: /patch/msgid/1461691808-12414-20-git-send-email-daniel.vetter@ffwll.ch/
    Traceback (most recent call last):
      File "django/core/handlers/base.py", line 132, in get_response
        response = wrapped_callback(request, *callback_args, **callback_kwargs)
      File "patchwork/views/patch.py", line 128, in msgid
        patch = get_object_or_404(Patch, msgid='<' + msgid + '>')
      File "shortcuts.py", line 155, in get_object_or_404
        return queryset.get(*args, **kwargs)
      File "django/db/models/query.py", line 338, in get
        (self.model._meta.object_name, num)
    MultipleObjectsReturned: get() returned more than one Patch -- it returned 2!
    Signed-off-by: default avatarDamien Lespiau <damien.lespiau@intel.com>
patch.py 4.96 KB