Ali Alnubani [Tue, 1 Aug 2023 08:15:35 +0000 (11:15 +0300)]
lib: add missing permissions for patchwork_covercomment_id_seq
Grants UPDATE and SELECT privileges on patchwork_covercomment_id_seq table
for user 'nobody' to fix the following exception when cover comments
are being parsed:
django.db.utils.ProgrammingError: permission denied for sequence
patchwork_covercomment_id_seq
Ali Alnubani [Mon, 31 Jul 2023 10:54:21 +0000 (13:54 +0300)]
lib: add missing permissions for patchwork_cover_id_seq
Grants UPDATE and SELECT privileges on patchwork_cover_id_seq table
for user 'nobody' to fix the following exception when cover letters
are being parsed:
django.db.utils.ProgrammingError: permission denied for sequence
patchwork_cover_id_seq
In commit 2653fdbb2, we started encoding slashes in message IDs
presented to users. This allowed us to support message IDs containing
slashes, which are allowed per the RFC and have been seen in the wild.
However, we continue to store the original unencoded message IDs in the
database and unfortunately we neglected to reverse the decoding in the
functions for downloading patch diffs and mboxes. Address this now.
Signed-off-by: Stephen Finucane <stephen@that.guru> Fixes: 2653fdbb2 ("urls: Encode slashes in message IDs") Closes: #518 Cc: Siddhesh Poyarekar <siddhesh@gotplt.org> Cc: DJ Delorie <dj@delorie.com>
Ali Alnubani [Tue, 20 Jun 2023 11:06:07 +0000 (14:06 +0300)]
lib: add missing permissions for patchwork_comment_id_seq
Grants UPDATE and SELECT privileges on patchwork_comment_id_seq table
for web and mail users to fix the following exception when comments
are parsed:
django.db.utils.ProgrammingError: permission denied for sequence
patchwork_comment_id_seq
Fixes: 5b53f46def5f ("lib: fix table names") Signed-off-by: Ali Alnubani <alialnu@nvidia.com>
requirements: Bump Django to 4.2.x, django-filter to 23.2.0
There are no apparent issues to be addressed this go round. Hurrah!
We also formally drop support for Django 4.0. This doesn't really mean
anything since we still support 3.2, but it means we can keep our test
matrix as small as possible.
Signed-off-by: Stephen Finucane <stephen@that.guru>
Stephen Finucane [Tue, 24 Jan 2023 23:31:22 +0000 (23:31 +0000)]
Correctly append tags on patches without commit details
Only a commit summary (a.k.a. patch subject) is necessary in Git: we
don't need details. The regex we were using to search for postscripts
however assumed that there would be _something_ before the postscript,
resulting in a newline. This wasn't the case. Correct this assumption by
instead using 're.MULTILINE' and matching on '^' and '$' for newlines
instead of '\n'.
Signed-off-by: Stephen Finucane <stephen@that.guru> Closes: #516 Cc: siddhesh@gotplt.org
PEP-440 regulates public and local version schemes. Git version string
will use local version scheme and alpha/stable releases will follow the
public one.
Signed-off-by: You-Sheng Yang (vicamo) <vicamo@gmail.com>
Stephen Finucane [Fri, 13 Jan 2023 12:20:01 +0000 (12:20 +0000)]
Additional updates for compatibility with tox 4
'[tox] skipsdist' behaves differently in tox 4 [1]. In addition, setting
'[testenv] basepython' with '[tox] ignore_basepython_conflict' has been
the cause of a few tox 4 bugs (most since fixed, thankfully) and might
be deprecated [2]. Remove it since we don't need it in any of our
environments.
Stephen Finucane [Mon, 10 Oct 2022 17:18:41 +0000 (18:18 +0100)]
Convert to OpenAPI 3.1
OpenAPI 3.0 has some unspecified behavior regarding the combination of
reference objects with 'nullable' [1]. Despite what random StackOverflow
answers [2] suggest, combining nullable with '$ref' still doesn't work.
Do what's suggested in the issue reporting this behavior [3] and upgrade
to OpenAPI 3.1, allowing us to work around this.
Stephen Finucane [Wed, 11 May 2022 13:52:36 +0000 (14:52 +0100)]
urls: Encode slashes in message IDs
We were attempting to work around the fact that message IDs could
contain slashes which in some cases broke our ability to generate
meaningful URLs. Rather than doing this, insist that users encode these
slashes so that we can distinguish between semantically meaningful
slashes and those that form the URL. This is a slightly breaking change,
but the current behavior is already broken (see the linked bug) so this
seems reasonable.
Signed-off-by: Stephen Finucane <stephen@that.guru> Closes: #433 Cc: dja@axtens.net Cc: siddhesh@gotplt.org
Stephen Finucane [Fri, 30 Sep 2022 12:17:46 +0000 (13:17 +0100)]
requirements: Bump Django to 3.2.x, djangorestframework to 4.16.0
There are two issues to be addressed:
RemovedInDjango50Warning: Passing response to assertFormError() is
deprecated. Use the form object directly:
RemovedInDjango50Warning: The "default.html" templates for forms and
formsets will be removed. These were proxies to the equivalent
"table.html" templates, but the new "div.html" templates will be the
default from Django 5.0. Transitional renderers are provided to allow
you to opt-in to the new output style now. See
https://docs.djangoproject.com/en/4.1/releases/4.1/ for more details
Nothing complicated in fixing either of these. For the former, we must
do as we're told and use the form object directly. For the latter, we
need to configure our own form renderer so we can continue using the
table form renderer for now.
Signed-off-by: Stephen Finucane <stephen@that.guru>
Stephen Finucane [Fri, 15 Jul 2022 16:02:36 +0000 (17:02 +0100)]
docs: Bump API version in docs to 1.3
We also need to add missing API documentation pages for this new API
version. These should have been added in commit 5b03443c ("api: add
auto-generated OpenAPI schema files")
Signed-off-by: Stephen Finucane <stephen@that.guru>
Stephen Finucane [Wed, 11 May 2022 09:30:45 +0000 (10:30 +0100)]
parser: Handle binary git patches
'git-format-patch' is able to generate binary patches. Fortunately,
these are quite easy to spot since they're explicitly labelled as such.
Add support for parsing these to the parser.
Signed-off-by: Stephen Finucane <stephen@that.guru> Closes: #463
Ali Alnubani [Sun, 24 Apr 2022 20:59:35 +0000 (23:59 +0300)]
lib: fix table names
Migration 0042 (introduced in 0686a73) renamed the "Comment" model
to "PatchComment", and some of the table names changed in a51e7cf
were already correct.
This reverts a51e7cf and removes a nonexistent table name to resolve
the following error:
$ psql -f lib/sql/grant-all.postgres.sql DATABASE_NAME
BEGIN
psql:lib/sql/grant-all.postgres.sql:38: ERROR: relation
"patchwork_comment" does not exist
Fixes: a51e7cfd95e2 ("lib: Correct PatchComment table") Fixes: 7b967db4e12f ("lib: Update DB permissions to reflect model changes") Cc: stephen@that.guru Closes: #396 Signed-off-by: Ali Alnubani <alialnu@nvidia.com>
Amazingly, the only functional change required here is to add an
additional piece of code to re-enable shift-select [1]. This is
otherwise a straight swap.
We recently started stripping comments and folding white space from the
In-Reply-To and References headers. Do so also for the Message-ID
header. Because of the importance of the Message-ID header, we accept
even non-compliant headers and because we now have a pattern for this,
we also start (re-)accepting non-compliant In-Reply-To headers.
Signed-off-by: Stephen Finucane <stephen@that.guru>
Related: #399
parser: Ignore CFWS in In-Reply-To, References headers
RFC2822 states that [1] a comment or folding white space is permitted to
be inserted before or after a msg-id in in the Message-ID, In-Reply-To
or References fields. Allow for this.
Stephen Finucane [Tue, 14 Apr 2020 09:46:05 +0000 (10:46 +0100)]
REST: Include 'first', 'last' refs in 'Link' header
I've no idea why this wasn't done from day one, but it's a huge
usability win for anyone attempting to do pagination with this header.
Note that this change is not versioned as I haven't figured out how to
do that at this layer.
Signed-off-by: Stephen Finucane <stephen@that.guru>
This patch stitches in "comment created" events for patches and cover
letter into the event queue.
Signed-off-by: DJ Delorie <dj@redhat.com> Signed-off-by: Stephen Finucane <stephen@that.guru> Closes: #424
[stephenfin: Extend to cover letters also. Fix some formatting issues.
Add a release note]
Stephen Finucane [Fri, 25 Mar 2022 11:57:33 +0000 (11:57 +0000)]
docker: Further refine logic to apply migrations
We don't want to apply migrations by default since this will cause WIP
migrations to be applied if someone runs e.g. 'docker-compose run'. What
we really want to check is "are there any migrations currently applied?"
and skip if so, but Django doesn't provide an easy way to do this, so we
instead check for a random Django application.
Signed-off-by: Stephen Finucane <stephen@that.guru>