patchew-project/patchew

Use git-publish to publish a single version are not recognized by patchew, I don't know if this is a git-publish issue or patchew issue #94

lygstate opened this issue · 3 comments

famz commented

With eyeball I don't see anything suspicious with the two patches. Will need to do some testing to tell...

famz commented

@bonzini The server spits this upon importing above patches:

    self.model._meta.object_name
api.models.DoesNotExist: Topic matching query does not exist.
Internal Server Error: /api/import/
Traceback (most recent call last):
  File "/opt/patchew/venv/lib64/python3.4/site-packages/django/core/handlers/exception.py", line 41, in inner
    response = get_response(request)
  File "/opt/patchew/venv/lib64/python3.4/site-packages/django/core/handlers/base.py", line 187, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/opt/patchew/venv/lib64/python3.4/site-packages/django/core/handlers/base.py", line 185, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/opt/patchew/venv/lib64/python3.4/site-packages/django/views/generic/base.py", line 68, in view
    return self.dispatch(request, *args, **kwargs)
  File "/opt/patchew/venv/lib64/python3.4/site-packages/django/utils/decorators.py", line 67, in _wrapper
    return bound_func(*args, **kwargs)
  File "/opt/patchew/venv/lib64/python3.4/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view
    return view_func(*args, **kwargs)
  File "/opt/patchew/venv/lib64/python3.4/site-packages/django/utils/decorators.py", line 63, in bound_func
    return func.__get__(self, type(self))(*args2, **kwargs2)
  File "/opt/patchew/api/views.py", line 29, in dispatch
    return super(APIView, self).dispatch(request, *args, **kwargs)
  File "/opt/patchew/venv/lib64/python3.4/site-packages/django/views/generic/base.py", line 88, in dispatch
    return handler(request, *args, **kwargs)
  File "/opt/patchew/api/views.py", line 47, in post
    r = self.handle(request, **params)
  File "/opt/patchew/api/views.py", line 195, in handle
    mbox, request.user
  File "/opt/patchew/api/models.py", line 509, in add_message_from_mbox
    if is_series_head
  File "/opt/patchew/api/models.py", line 552, in for_stripped_subject
    topic = self.get(pk=q[0]["topic"])
  File "/opt/patchew/venv/lib64/python3.4/site-packages/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/opt/patchew/venv/lib64/python3.4/site-packages/django/db/models/query.py", line 380, in get
    self.model._meta.object_name
api.models.DoesNotExist: Topic matching query does not exist.

This seems to be part of the Topic work.

I am not sure about the assumptions made by for_stripped_subject here, we seem to only set topic for series heads in add_message_from_mbox but here we query all messages with the stripped subject.

Maybe we want:

@@ -543,7 +544,7 @@ class QueuedSeries(models.Model):
 class TopicManager(models.Manager):
     def for_stripped_subject(self, stripped_subject):
         q = (
-            Message.objects.filter(stripped_subject=stripped_subject)
+            Message.objects.filter(stripped_subject=stripped_subject, topic__isnull=False)
             .order_by("date")
             .reverse()[:1]
             .values("topic")

Paolo, could you confirm?

famz commented

Fixed by 6de904a