From patchwork Tue Apr 30 06:02:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Axtens X-Patchwork-Id: 1092995 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44tWFf1Cyfz9s9y for ; Tue, 30 Apr 2019 16:04:38 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=axtens.net Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=axtens.net header.i=@axtens.net header.b="HcBFXNrJ"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 44tWFf08WQzDqMP for ; Tue, 30 Apr 2019 16:04:38 +1000 (AEST) X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=axtens.net (client-ip=2607:f8b0:4864:20::433; helo=mail-pf1-x433.google.com; envelope-from=dja@axtens.net; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=axtens.net Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=axtens.net header.i=@axtens.net header.b="HcBFXNrJ"; dkim-atps=neutral Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 44tWDB57PGzDqRk for ; Tue, 30 Apr 2019 16:03:22 +1000 (AEST) Received: by mail-pf1-x433.google.com with SMTP id b3so6550564pfd.1 for ; Mon, 29 Apr 2019 23:03:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axtens.net; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4bWS9szyPvj1eJs6nf65IPYEdDdZQUJupehPNTeIPQI=; b=HcBFXNrJmvxEzHkFb2aXO18URmKtJuHPP+RZquXkasGR+VEj6bmVDcFA9SW0I0iPba k2R3CwCEhmnHcNeaTv9O0vjEnHMd6DS/qJhcVLHKMT4W3jfCBN01RnfO4/SBVVO9xVHZ UzWJkOFs/PLZhXgVx1q/ns1srJn7v3NyqZd0Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4bWS9szyPvj1eJs6nf65IPYEdDdZQUJupehPNTeIPQI=; b=AOLLjn2WMtLQjFCbdjHdWvngErKrwTMVlegTI2rWquL7giZXsntyumOB3+DMlW3Nrs s4gLHzCH9gP7KfUf0JZVOQHr5YlvgsEhxX06liDtUg3zi+1Vr2e74kCvl/QH47B0/eJV d1nonEPDYxGc7+vDxkF6UexOvQaMdG2pey3N6GzpHB3p4BPSl8hNv2VBytdbDMoHby1T g17JQ4eZWu2NqGjFghTyMWuM9TN8nBU6PQBYMwiQiDo4hAJVuTLq8vrVoF/GCMYCeJdU dbayqeSxI3pKG/gMPaB4V4nb3rQsWOSQg0ILNQLL2qa1haXioPeHE3WrTzHvNYkUPzYW 5weg== X-Gm-Message-State: APjAAAVCI4mzEvS/1PIlvPMmd1nHGRMr99DsTkYI1sltiSWuILa3HFO+ m0gsyGLI+TV2OTURqY5/VFe4vChfSTY= X-Google-Smtp-Source: APXvYqzBkJofVZtsn/jVviMvFLZoANfjiPPwGsqwOD/W5GUKdR1ReQOzJ5LaHSDmyRDWIIywKQrcOw== X-Received: by 2002:a62:5fc7:: with SMTP id t190mr67654727pfb.191.1556604199825; Mon, 29 Apr 2019 23:03:19 -0700 (PDT) Received: from localhost (203-217-53-131.dyn.iinet.net.au. [203.217.53.131]) by smtp.gmail.com with ESMTPSA id t13sm28264759pgj.49.2019.04.29.23.03.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 29 Apr 2019 23:03:19 -0700 (PDT) From: Daniel Axtens To: patchwork@lists.ozlabs.org Subject: [PATCH 01/10] REST: Check.user is not read-only Date: Tue, 30 Apr 2019 16:02:59 +1000 Message-Id: <20190430060308.10432-2-dja@axtens.net> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190430060308.10432-1-dja@axtens.net> References: <20190430060308.10432-1-dja@axtens.net> MIME-Version: 1.0 X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" From: Stephen Finucane We only support 'Check' creation - not check updating. As a result, there's no real reason that the 'Check.user' field should be read-only and this is causing an issue with Django REST Framework 3.7. Simply remove the attribute and extend the tests to validate things are working as expected. Signed-off-by: Stephen Finucane Reviewed-by: Daniel Axtens Signed-off-by: Daniel Axtens (cherry picked from commit c9cc59dac70d76971a5342ca53e2b13eb93592de) Signed-off-by: Daniel Axtens --- patchwork/api/check.py | 2 +- patchwork/tests/api/test_check.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/patchwork/api/check.py b/patchwork/api/check.py index 594ecd4bfeec..d76573a528ec 100644 --- a/patchwork/api/check.py +++ b/patchwork/api/check.py @@ -46,7 +46,7 @@ class CheckSerializer(HyperlinkedModelSerializer): url = CheckHyperlinkedIdentityField('api-check-detail') patch = HiddenField(default=CurrentPatchDefault()) - user = UserSerializer(read_only=True, default=CurrentUserDefault()) + user = UserSerializer(default=CurrentUserDefault()) def run_validation(self, data): for val, label in Check.STATE_CHOICES: diff --git a/patchwork/tests/api/test_check.py b/patchwork/tests/api/test_check.py index bc06e86e5bb3..f5a8eca155a9 100644 --- a/patchwork/tests/api/test_check.py +++ b/patchwork/tests/api/test_check.py @@ -67,6 +67,7 @@ class TestCheckAPI(APITestCase): self.assertEqual(check_obj.target_url, check_json['target_url']) self.assertEqual(check_obj.context, check_json['context']) self.assertEqual(check_obj.description, check_json['description']) + self.assertEqual(check_obj.user.id, check_json['user']['id']) def test_list(self): """Validate we can list checks on a patch.""" From patchwork Tue Apr 30 06:03:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Axtens X-Patchwork-Id: 1092996 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44tWFy3J09z9s7T for ; Tue, 30 Apr 2019 16:04:54 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=axtens.net Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=axtens.net header.i=@axtens.net header.b="ThS6R1XK"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 44tWFy1lbjzDqMp for ; Tue, 30 Apr 2019 16:04:54 +1000 (AEST) X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=axtens.net (client-ip=2607:f8b0:4864:20::536; helo=mail-pg1-x536.google.com; envelope-from=dja@axtens.net; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=axtens.net Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=axtens.net header.i=@axtens.net header.b="ThS6R1XK"; dkim-atps=neutral Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 44tWDG5B3RzDqHd for ; Tue, 30 Apr 2019 16:03:26 +1000 (AEST) Received: by mail-pg1-x536.google.com with SMTP id j26so6334890pgl.5 for ; Mon, 29 Apr 2019 23:03:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axtens.net; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=R6i9pW6I8XiYTvG8xWI1j4+b3s7drO9AS7iaQG7Z1X0=; b=ThS6R1XK74NnvlQ7sxGdVygcrqqz0hpnQFqv4S1r9yjnMoji2zzNlvqBDL61QPylgm XEMFDf/LQzO5ebojIhdYzddQaWiL+HSGgo3quxpAKZm4heOCZ117NcUSbe6zP0IdhcRK bAcfC7XZ3T2LpjB4Auf9TU/ExfWF2HHR5gbQQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=R6i9pW6I8XiYTvG8xWI1j4+b3s7drO9AS7iaQG7Z1X0=; b=hMdfLQSlhX/5+5jOZJR109cw2aLLmpE5zCWCO7uF9mBy32x3aciOvelyQpiBapQvHD axoKc7z4IVFsTDjCV/zD7nmvn+aQZQSVH8W926OcRM6HQSC9z2+nxKN+bHXze9eYB7fG GWkZzoILhVAhOuFbzH0UReLlnHJwvNWwpvsOicbszyrnLc0WLVx1IsXiNJ7Lzt4sOMzs nQ9Gmxp55gIt4l25VwpJxsKCdcpLiY4rfjQUW31QD58t5AVCx4xoQwMkqzt7ODQgWR9B ScZUI3e40OTXdsP6JE9nVHnUAQ9Z1myrUUPZbYkVSDPZ3YLM7yN33WdsdRVmKOA7vhJb 9d2w== X-Gm-Message-State: APjAAAWo2ZUxE/Ftsot5OtSwVH8y5kjl+N6igCU4a87pY2Zwymhd3Or8 YOVUEkhmR3JE1tldWjzhR4lCFz5tgP4= X-Google-Smtp-Source: APXvYqzJyrcFY3JEvDfHastuQ0nVqg8m5KvE0ydbjn8RIlHKJLXlNFOg9LjIL+VtYjbV7pmojXpnrA== X-Received: by 2002:a62:6e05:: with SMTP id j5mr68550387pfc.5.1556604204358; Mon, 29 Apr 2019 23:03:24 -0700 (PDT) Received: from localhost (203-217-53-131.dyn.iinet.net.au. [203.217.53.131]) by smtp.gmail.com with ESMTPSA id w125sm7784809pfw.69.2019.04.29.23.03.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 29 Apr 2019 23:03:23 -0700 (PDT) From: Daniel Axtens To: patchwork@lists.ozlabs.org Subject: [PATCH 02/10] REST: Add new setting for maximum API page size Date: Tue, 30 Apr 2019 16:03:00 +1000 Message-Id: <20190430060308.10432-3-dja@axtens.net> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190430060308.10432-1-dja@axtens.net> References: <20190430060308.10432-1-dja@axtens.net> MIME-Version: 1.0 X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Donnellan Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" From: Andrew Donnellan In 41790caf59ad ("REST: Limit max page size") we limited the maximum page size to the default page size in the settings. This turns out to be rather restrictive, as we usually want to keep the default page size low, but an administrator may want to allow API clients to fetch more than that per request. Add a new setting, MAX_REST_RESULTS_PER_PAGE, to set the maximum page size. Closes: #202 ("Separate max API page size and default API page size into different settings") Suggested-by: Stewart Smith Suggested-by: Joel Stanley Signed-off-by: Andrew Donnellan [dja: set to 250 as per mailing list discussion] Signed-off-by: Daniel Axtens (cherry picked from commit 8fe11180a1a59f6e8e5a4441b21a3d9831f0b69d) Signed-off-by: Daniel Axtens --- docs/deployment/configuration.rst | 8 +++++++- patchwork/api/base.py | 3 ++- patchwork/settings/base.py | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/deployment/configuration.rst b/docs/deployment/configuration.rst index 347485636d47..e599522a412b 100644 --- a/docs/deployment/configuration.rst +++ b/docs/deployment/configuration.rst @@ -88,7 +88,13 @@ Enable the :doc:`REST API <../api/rest>`. The number of items to include in REST API responses by default. This can be overridden by the ``per_page`` parameter for some endpoints. -.. versionadded:: 2.0 +``MAX_REST_RESULTS_PER_PAGE`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The maximum number of items that can be requested in a REST API request using +the ``per_page`` parameter. + +.. versionadded:: 2.2 ``COMPAT_REDIR`` ~~~~~~~~~~~~~~~~ diff --git a/patchwork/api/base.py b/patchwork/api/base.py index 8c38d5a1d5f4..bf452f78b390 100644 --- a/patchwork/api/base.py +++ b/patchwork/api/base.py @@ -36,7 +36,8 @@ class LinkHeaderPagination(PageNumberPagination): https://tools.ietf.org/html/rfc5988#section-5 https://developer.github.com/guides/traversing-with-pagination """ - page_size = max_page_size = settings.REST_RESULTS_PER_PAGE + page_size = settings.REST_RESULTS_PER_PAGE + max_page_size = settings.MAX_REST_RESULTS_PER_PAGE page_size_query_param = 'per_page' def get_paginated_response(self, data): diff --git a/patchwork/settings/base.py b/patchwork/settings/base.py index 4b0d5513895a..45c66da79e67 100644 --- a/patchwork/settings/base.py +++ b/patchwork/settings/base.py @@ -220,6 +220,7 @@ ENABLE_XMLRPC = False ENABLE_REST_API = True REST_RESULTS_PER_PAGE = 30 +MAX_REST_RESULTS_PER_PAGE = 250 # Set to True to enable redirections or URLs from previous versions # of patchwork From patchwork Tue Apr 30 06:03:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Axtens X-Patchwork-Id: 1092997 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44tWGP6tnXz9s9y for ; Tue, 30 Apr 2019 16:05:17 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=axtens.net Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=axtens.net header.i=@axtens.net header.b="J2vht4ic"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 44tWGP5nwxzDqRh for ; Tue, 30 Apr 2019 16:05:17 +1000 (AEST) X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=axtens.net (client-ip=2607:f8b0:4864:20::544; helo=mail-pg1-x544.google.com; envelope-from=dja@axtens.net; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=axtens.net Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=axtens.net header.i=@axtens.net header.b="J2vht4ic"; dkim-atps=neutral Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 44tWDM6p5FzDqMl for ; Tue, 30 Apr 2019 16:03:31 +1000 (AEST) Received: by mail-pg1-x544.google.com with SMTP id e6so6336709pgc.4 for ; Mon, 29 Apr 2019 23:03:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axtens.net; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RAgPMv9LHw3mIp8RaynuyWcrN+6u3MqBcSXVOz+CMH8=; b=J2vht4icJgHKUUQ+hJcpXUHf868Jof+OWvNDqkr43xdVu5sDPnfGtjZ2sYIe2cMOxp tSnRti2WH6im9QQQnfBcbRZwvqafLZ+VpozL7Lovdr3VBr2dB4/09REuzLnpgoVslLL6 +wOqnUMEWQZJm5GT0QK4ZBKJ3AZA9Sq2op01M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RAgPMv9LHw3mIp8RaynuyWcrN+6u3MqBcSXVOz+CMH8=; b=rRc/jkVS/cG4qCx5iwNUp827ye65IcedvO5xevL4a/KsqnCRWa61WZand+cPqgZ6pQ CX5E/aYAQ96R6dhbnj1np5VpEvGzoiQ8QFXhyrLT0S3+gVJGeLHNtxEL8Txr3/I8SHKB rwo+qeH2GhKzdAojGwoEhDEwusJXvPHKxeN+9qwhn61/PUv8/TlSKfyzFYgUBimzE1ns F2FhIo1FU9qLe6HJw9z2evUU5M3VZf+h+RbTAQ/oypQphtUds5SfRU/+Y4nqReANT+PE gQEc1PHpoD+GWt9ecGEfqgUfuN7T4mXyyMQEmhOdk4t8hJ7WnA8w+84Wb/wLKFZgSy/R hZ4g== X-Gm-Message-State: APjAAAWjLwW8L+mGp6wDGPgO6B5B4+/EkB9tYdWa2h1tkecWVxYFL4Z3 Afocw22T/1hZg0R1E7nVEVbP3iagMo4= X-Google-Smtp-Source: APXvYqyzldXebkAcGffXxeAMLmf+W8YwSqLlvGZkZ31rijXtG/P5N+jW6DG6dgDBI0tZ8p2WXkai9Q== X-Received: by 2002:aa7:8dc3:: with SMTP id j3mr2175758pfr.141.1556604209153; Mon, 29 Apr 2019 23:03:29 -0700 (PDT) Received: from localhost (203-217-53-131.dyn.iinet.net.au. [203.217.53.131]) by smtp.gmail.com with ESMTPSA id s85sm62276998pfa.23.2019.04.29.23.03.27 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 29 Apr 2019 23:03:28 -0700 (PDT) From: Daniel Axtens To: patchwork@lists.ozlabs.org Subject: [PATCH 03/10] notifications: fix notification expiry when no user is associated Date: Tue, 30 Apr 2019 16:03:01 +1000 Message-Id: <20190430060308.10432-4-dja@axtens.net> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190430060308.10432-1-dja@axtens.net> References: <20190430060308.10432-1-dja@axtens.net> MIME-Version: 1.0 X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jeremy Kerr Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" From: Jeremy Kerr It's possible that an EmailConfirmation object will have no associated user (eg, for email opt-out, which does not require a user object). In this case, we will see a NULL value for EmailConfirmation.user_id. However, having a NULL value appear in a SQL 'IN' clause will match every value. This means that once one of these null-user EmailConfirmations is present, we will never expire any non-active user accounts. This change adds a filter for a valid user_id when we query for active EmailConfirmation objects. This means we'll have a valid values set to use in the pending_confs set. Signed-off-by: Jeremy Kerr [dja: fix pep8 issue] Signed-off-by: Daniel Axtens (cherry picked from commit d0b79d9dee04aee13c8d64a193a7818f72eeca3b) Signed-off-by: Daniel Axtens --- patchwork/notifications.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/patchwork/notifications.py b/patchwork/notifications.py index a5f642352c1d..dce525aba57e 100644 --- a/patchwork/notifications.py +++ b/patchwork/notifications.py @@ -109,7 +109,8 @@ def expire_notifications(): EmailConfirmation.objects.filter(q).delete() # remove inactive users with no pending confirmation - pending_confs = EmailConfirmation.objects.values('user') + pending_confs = (EmailConfirmation.objects + .filter(user__isnull=False).values('user')) users = User.objects.filter(is_active=False).exclude(id__in=pending_confs) # delete users From patchwork Tue Apr 30 06:03:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Axtens X-Patchwork-Id: 1092998 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44tWGk3Q7jz9s7T for ; Tue, 30 Apr 2019 16:05:34 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=axtens.net Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=axtens.net header.i=@axtens.net header.b="eXn9P5A5"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 44tWGj6XvJzDqRL for ; Tue, 30 Apr 2019 16:05:33 +1000 (AEST) X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=axtens.net (client-ip=2607:f8b0:4864:20::42d; helo=mail-pf1-x42d.google.com; envelope-from=dja@axtens.net; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=axtens.net Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=axtens.net header.i=@axtens.net header.b="eXn9P5A5"; dkim-atps=neutral Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 44tWDT0k1jzDqMm for ; Tue, 30 Apr 2019 16:03:36 +1000 (AEST) Received: by mail-pf1-x42d.google.com with SMTP id z26so2653924pfg.6 for ; Mon, 29 Apr 2019 23:03:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axtens.net; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rmfpnAcONdApz9T0CjrXVYAmCK5FvcdeVVmyZU59GKQ=; b=eXn9P5A5BU3vkRfSTDxfRrq1HmGS7S+oEZ3Qv4nD2Kw7pL7t+FXxwTnaJDOPFUHStX avhiUDFaM3xbasFMN9cKSIjdziS5vdbFB8u7ay7lEzWHBgEwr87qC69qhhnqWR+P8gc/ JPLUPYy3aYCRN/2FegDWMgff7pL0+Ge+wyPqw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rmfpnAcONdApz9T0CjrXVYAmCK5FvcdeVVmyZU59GKQ=; b=ocM7S1b1Go0UlUcWmPQaO6tlekJe5TmNM8Zrfj34R1ZhSLuaAkQz9IiG/2SQbZoybQ +9kYFdHUDsDvFqDXiAzZp/+CcnbXHZql962YVqaYsOwiVhjUsPlfMEdMzXajtoCdEK9p wYeGSbzNwQ70ldLn7UILubBKsVMp6Hrc1bZ3xZhl6uQLqojEpxj9btco2xF8QXY2L5YK 8v9GE49NpURG4R5uMnKL9YmwpnlF27KRY+zk9t5cNBOZdLnCaHAP6sf+QSnrlJ2m5ZJ+ xreqlHd5ygh3/HaiKDv9t7JTCyAauLBX1Lf7bdeg14QeDhciZ5kCNqk6oRpCN06ucs2A nk8Q== X-Gm-Message-State: APjAAAUuaT+hlR1dd/2UnO6dFB0muIkAV5o5dDHENGgcjtK/rHWW98+K 5R8dyC923dZ+Y7YIjgj+qBKLs6ZUfFw= X-Google-Smtp-Source: APXvYqys7/h4IqGpXnF6cjyXa0nTTlsMhdy+afEvFxFvArLxSLOgxcqIG7uI1Rq5j0TcY2Aqx8mCjQ== X-Received: by 2002:a65:5342:: with SMTP id w2mr45427859pgr.220.1556604214357; Mon, 29 Apr 2019 23:03:34 -0700 (PDT) Received: from localhost (203-217-53-131.dyn.iinet.net.au. [203.217.53.131]) by smtp.gmail.com with ESMTPSA id e184sm55166084pfc.102.2019.04.29.23.03.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 29 Apr 2019 23:03:33 -0700 (PDT) From: Daniel Axtens To: patchwork@lists.ozlabs.org Subject: [PATCH 04/10] REST: Handle JSON requests Date: Tue, 30 Apr 2019 16:03:02 +1000 Message-Id: <20190430060308.10432-5-dja@axtens.net> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190430060308.10432-1-dja@axtens.net> References: <20190430060308.10432-1-dja@axtens.net> MIME-Version: 1.0 X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" From: Stephen Finucane This was raising an attribute error when switching tests to use JSON bodies instead of form-data. AttributeError: 'dict' object has no attribute '_mutable' The easy fix is to check if it's a dictionary and avoid the mutability check if so. Signed-off-by: Stephen Finucane (cherry picked from commit dc48fbce99efe7d13987a3f510f7dee389636eba This is needed for JSON bodies sent by regular users, not just the tests.) Signed-off-by: Daniel Axtens --- patchwork/api/check.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/patchwork/api/check.py b/patchwork/api/check.py index d76573a528ec..67062132fef3 100644 --- a/patchwork/api/check.py +++ b/patchwork/api/check.py @@ -50,7 +50,12 @@ class CheckSerializer(HyperlinkedModelSerializer): def run_validation(self, data): for val, label in Check.STATE_CHOICES: - if label == data['state']: + if label != data['state']: + continue + + if isinstance(data, dict): # json request + data['state'] = val + else: # form-data request # NOTE(stephenfin): 'data' is essentially 'request.POST', which # is immutable by default. However, there's no good reason for # this to be this way [1], so temporarily unset that mutability @@ -61,7 +66,8 @@ class CheckSerializer(HyperlinkedModelSerializer): data._mutable = True # noqa data['state'] = val data._mutable = mutable # noqa - break + + break return super(CheckSerializer, self).run_validation(data) def to_representation(self, instance): From patchwork Tue Apr 30 06:03:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Axtens X-Patchwork-Id: 1093000 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44tWH670LZz9s7T for ; Tue, 30 Apr 2019 16:05:54 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=axtens.net Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=axtens.net header.i=@axtens.net header.b="Y7brguS8"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 44tWH64gCpzDqB5 for ; Tue, 30 Apr 2019 16:05:54 +1000 (AEST) X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=axtens.net (client-ip=2607:f8b0:4864:20::533; helo=mail-pg1-x533.google.com; envelope-from=dja@axtens.net; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=axtens.net Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=axtens.net header.i=@axtens.net header.b="Y7brguS8"; dkim-atps=neutral Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 44tWDY6RxxzDqQr for ; Tue, 30 Apr 2019 16:03:41 +1000 (AEST) Received: by mail-pg1-x533.google.com with SMTP id h1so6342584pgs.2 for ; Mon, 29 Apr 2019 23:03:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axtens.net; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BU5/txA95pIcpxetb02GqPrOK10y4A2TRlOa9uUKYDM=; b=Y7brguS8FSf+ni9Odgasd1A59oqpAHWucLMOUvwbRqr+QDupaGqOZvsUmbhSB66fZv Fuja9kFAF04GbLZbUhWvPDr6BDQL3xln0fJxI/oepxeWERB6/SkyLsRb+cr/yTcFdPAI irSJinwMa49mPxuxTYf6l6n9x790jV7nl1xnk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BU5/txA95pIcpxetb02GqPrOK10y4A2TRlOa9uUKYDM=; b=p+6MgdqWnebnHh6CP8GB5RzUvfw9VPbAydb9V0RauI93RQt0NCTcRKnqni3/esgbZG nqSufJbdkX/dGpqD3t0xDGHxrZ27bKz8nCnNfj7vX/9p1P5DjKDO56BigZxSpsGrlYWB WTCLYJK4+A6PCqKbFRyRV36+GOGp4ClCMXKw+Z7sZsaVdbELu8dCsGlNyTy+geTodxdt TBMeguDeke6Vcnjp+p+YpZLpKj7xpqb3gxmgzBV4hQfYTMwdoCQmHmi8d9egaq8doBpm rN4JT4B8pfwxTxWwvol5mF6spnm0d23iPIeb7ugGYYFLwV73RzIMZcG3OHWBIr3Ryr1K OrsQ== X-Gm-Message-State: APjAAAXeoPA4grwFho1pRLOXlAbto9X3mMVCUaG/2q3hnFHdexSwtVwa 8YAxFtreOlt6bsUWfPSVaWmMzMcA0JU= X-Google-Smtp-Source: APXvYqx9iSwgNlD/8CLOlKrKmvXnsFqGLNBPF0lcOy6n6+Dt/2teG1Fl8ZsAxZR5afbYq2I3kwcV7g== X-Received: by 2002:a65:4185:: with SMTP id a5mr63585122pgq.82.1556604219241; Mon, 29 Apr 2019 23:03:39 -0700 (PDT) Received: from localhost (203-217-53-131.dyn.iinet.net.au. [203.217.53.131]) by smtp.gmail.com with ESMTPSA id y20sm48217802pfe.188.2019.04.29.23.03.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 29 Apr 2019 23:03:38 -0700 (PDT) From: Daniel Axtens To: patchwork@lists.ozlabs.org Subject: [PATCH 05/10] REST: Handle regular form data requests for checks Date: Tue, 30 Apr 2019 16:03:03 +1000 Message-Id: <20190430060308.10432-6-dja@axtens.net> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190430060308.10432-1-dja@axtens.net> References: <20190430060308.10432-1-dja@axtens.net> MIME-Version: 1.0 X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" 08d1459a4a40 ("Add REST API validation using OpenAPI schema") moved all API requests to JSON blobs rather than form data. dc48fbce99ef ("REST: Handle JSON requests") attempted to change the check serialiser to handle this. However, because both a JSON dict and a QueryDict satisfy isinstance(data, dict), everything was handled as JSON and the old style requests were broken. Found in the process of debugging issues from the OzLabs PW & Snowpatch crew - I'm not sure if they actually hit this one, but kudos to them anyway as we wouldn't have found it without them. Fixes: dc48fbce99ef ("REST: Handle JSON requests") (backported from commit 666de29ebada5990a8d69f4d71d6bb271e1a68c3 This does not need the new tests as we do not have 08d1459a4a40, so we just need the fix to the api. We do not add a JSON test to stable.) Signed-off-by: Daniel Axtens --- patchwork/api/check.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/patchwork/api/check.py b/patchwork/api/check.py index 67062132fef3..62e6fd19e761 100644 --- a/patchwork/api/check.py +++ b/patchwork/api/check.py @@ -19,6 +19,7 @@ from django.http import Http404 from django.shortcuts import get_object_or_404 +from django.http.request import QueryDict from rest_framework.exceptions import PermissionDenied from rest_framework.generics import ListCreateAPIView from rest_framework.generics import RetrieveAPIView @@ -53,9 +54,7 @@ class CheckSerializer(HyperlinkedModelSerializer): if label != data['state']: continue - if isinstance(data, dict): # json request - data['state'] = val - else: # form-data request + if isinstance(data, QueryDict): # form-data request # NOTE(stephenfin): 'data' is essentially 'request.POST', which # is immutable by default. However, there's no good reason for # this to be this way [1], so temporarily unset that mutability @@ -66,6 +65,8 @@ class CheckSerializer(HyperlinkedModelSerializer): data._mutable = True # noqa data['state'] = val data._mutable = mutable # noqa + else: # json request + data['state'] = val break return super(CheckSerializer, self).run_validation(data) From patchwork Tue Apr 30 06:03:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Axtens X-Patchwork-Id: 1093001 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44tWHT4J8qz9s7T for ; Tue, 30 Apr 2019 16:06:13 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=axtens.net Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=axtens.net header.i=@axtens.net header.b="BKmFQI1U"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 44tWHT35XpzDqMP for ; Tue, 30 Apr 2019 16:06:13 +1000 (AEST) X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=axtens.net (client-ip=2607:f8b0:4864:20::543; helo=mail-pg1-x543.google.com; envelope-from=dja@axtens.net; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=axtens.net Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=axtens.net header.i=@axtens.net header.b="BKmFQI1U"; dkim-atps=neutral Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 44tWDg6CsGzDqRr for ; Tue, 30 Apr 2019 16:03:47 +1000 (AEST) Received: by mail-pg1-x543.google.com with SMTP id i21so2880477pgi.12 for ; Mon, 29 Apr 2019 23:03:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axtens.net; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FVneJPaSsxXB8Ke5glQOMAqq8iLXtHDSWYUIA6UbKYs=; b=BKmFQI1UJkQoPoKL/zF/YLUNL7yERTIWdUM9vQkHiJEJ2ZxBXECM7gLI2cq5Qsu7b2 Gz7R0wnBHqrDbV2JU8w2BxhQTvJaIWGYkIui1mjXM8Yyy//Cj3i98vvCNfebxiqII5uX D8MnZdyvyk5MCUQFRKuP6cr6E19qBmSS8TUD0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FVneJPaSsxXB8Ke5glQOMAqq8iLXtHDSWYUIA6UbKYs=; b=mxcAxNZz7xq1aq6Z4JAu5fcCBBAvEOlL+xtl5QfacwylhAh8Azm0CCbtAo9VBJIYqy 2TWSucIphdTZoGtQNyQ+4fqCp1rviIwg+uyiKqrbkg60SrrVo5frH0gUEeCtx05Ir9Oq VuXoFJnNHt7qYIj7qJGOgj8f0IkDDQjXDs22kw6SKZkiGNRvUx5A/ES+4ARzD9k3f6tW rBwmQFbyPI7yeJDX8VrUsR8Ar79tgfYgDyYeMfamQnfAAo3FCifMxUFgqYvoljd8i8+N 1yjvqPSv6Pb60lHxfrWvnzoVSB2YOnmhN3wvk0ARSqlbeTn5ISvvIiEge4iqwc5gk9vi QsMg== X-Gm-Message-State: APjAAAVBxMvTPOWmNubdByrbPiUlkiqaayKF7yGt6mWY9sLBOuRfOHEd 3nIXeZCtE3WO+efgiIa8PIJeorwWCMA= X-Google-Smtp-Source: APXvYqwLzDdGJeH/3EPpUBBCx8a9t2LFudEXFPDFevXdzhX0yCjsKFhG6IyFUNoI49cUEYT4MSFi8A== X-Received: by 2002:a63:f444:: with SMTP id p4mr64191784pgk.32.1556604224239; Mon, 29 Apr 2019 23:03:44 -0700 (PDT) Received: from localhost (203-217-53-131.dyn.iinet.net.au. [203.217.53.131]) by smtp.gmail.com with ESMTPSA id t13sm71161075pgo.14.2019.04.29.23.03.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 29 Apr 2019 23:03:43 -0700 (PDT) From: Daniel Axtens To: patchwork@lists.ozlabs.org Subject: [PATCH 06/10] REST: A check must specify a state Date: Tue, 30 Apr 2019 16:03:04 +1000 Message-Id: <20190430060308.10432-7-dja@axtens.net> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190430060308.10432-1-dja@axtens.net> References: <20190430060308.10432-1-dja@axtens.net> MIME-Version: 1.0 X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" The Ozlabs crew noticed that a check without a state caused a KeyError in data['state']. Mark state as mandatory, check for it, and add a test. Reported-by: Russell Currey Reported-by: Jeremy Kerr Signed-off-by: Daniel Axtens (backported from commit 7a20ccda99e48dab643d1fbd7e170fe3e4c47185 No Swagger schema changes in the stable backport.) Signed-off-by: Daniel Axtens --- patchwork/api/check.py | 4 ++++ patchwork/tests/api/test_check.py | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/patchwork/api/check.py b/patchwork/api/check.py index 62e6fd19e761..1498abbbffb2 100644 --- a/patchwork/api/check.py +++ b/patchwork/api/check.py @@ -26,6 +26,7 @@ from rest_framework.generics import RetrieveAPIView from rest_framework.serializers import CurrentUserDefault from rest_framework.serializers import HiddenField from rest_framework.serializers import HyperlinkedModelSerializer +from rest_framework.serializers import ValidationError from patchwork.api.base import CheckHyperlinkedIdentityField from patchwork.api.base import MultipleFieldLookupMixin @@ -50,6 +51,9 @@ class CheckSerializer(HyperlinkedModelSerializer): user = UserSerializer(default=CurrentUserDefault()) def run_validation(self, data): + if 'state' not in data or data['state'] == '': + raise ValidationError({'state': ["A check must have a state."]}) + for val, label in Check.STATE_CHOICES: if label != data['state']: continue diff --git a/patchwork/tests/api/test_check.py b/patchwork/tests/api/test_check.py index f5a8eca155a9..e3ad099cf656 100644 --- a/patchwork/tests/api/test_check.py +++ b/patchwork/tests/api/test_check.py @@ -147,6 +147,22 @@ class TestCheckAPI(APITestCase): self.assertEqual(status.HTTP_400_BAD_REQUEST, resp.status_code) self.assertEqual(0, Check.objects.all().count()) + def test_create_missing_state(self): + """Create a check using invalid values. + + Ensure we handle the state being absent. + """ + check = { + 'target_url': 'http://t.co', + 'description': 'description', + 'context': 'context', + } + + self.client.force_authenticate(user=self.user) + resp = self.client.post(self.api_url(), check) + self.assertEqual(status.HTTP_400_BAD_REQUEST, resp.status_code) + self.assertEqual(0, Check.objects.all().count()) + def test_create_invalid_patch(self): """Ensure we handle non-existent patches.""" check = { From patchwork Tue Apr 30 06:03:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Axtens X-Patchwork-Id: 1093002 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44tWHn2t57z9s7T for ; Tue, 30 Apr 2019 16:06:29 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=axtens.net Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=axtens.net header.i=@axtens.net header.b="qWIfETka"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 44tWHn1dFgzDqRn for ; Tue, 30 Apr 2019 16:06:29 +1000 (AEST) X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=axtens.net (client-ip=2607:f8b0:4864:20::533; helo=mail-pg1-x533.google.com; envelope-from=dja@axtens.net; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=axtens.net Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=axtens.net header.i=@axtens.net header.b="qWIfETka"; dkim-atps=neutral Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 44tWDl415QzDqMm for ; Tue, 30 Apr 2019 16:03:51 +1000 (AEST) Received: by mail-pg1-x533.google.com with SMTP id j26so6335356pgl.5 for ; Mon, 29 Apr 2019 23:03:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axtens.net; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QxELk3Vd4MxWmiqGtPr3A2RDOtHJzM8KGad5ajHG/EI=; b=qWIfETkahNbzFZL7QwIm1G4i1RX6saahMrUmo33fzCxxcw1NEnFfsaX86xU55cVFrC XOLrGb542rjNU5yMESrER6PIuA1iGGMNw7qEz3AKMit3L6YwyHJA35ITF0LV/LY14ckK u8yQybE7iE1c0BQVy/TVJ8vwRtqUn795WP0YU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QxELk3Vd4MxWmiqGtPr3A2RDOtHJzM8KGad5ajHG/EI=; b=FWb3mg7jxuXw3caWUp/GzAB1gadaV0NSPsulX2s/jC45NgbTNk491BGqbpP2SZzd8m 0sPijNMFHbcXM9wHr1bAOLlcePtdKQZidPiENP26HILAkT5KnoYhllSPhktSJtHAdwEV z47pkKuyMlhNNw/eqcXe0pLKz6vYwcvCUGj6F+7DuaILV6LeZ6E4XYfxcJpjJCacrk4B qYXlWHVOan4EpnAM+JJpb5hvhjSoDwMsX2b+66uiY91v8l9hDBi46NRdxiRtT0dS1wul MhPqzniG1iZvSIem/bNnJJG5sk2MN/uJh7jCEm7pn8+zJmJqXNNR7TWcad1o0UvItNUu 6RQw== X-Gm-Message-State: APjAAAVE+3zXg+/fwX8KYitaO8IBslJK+mcfdDKu9JwNu9Eq0K9bPvJk Y0eafp+/BQbX+o572HRcw+XvGrxKnfU= X-Google-Smtp-Source: APXvYqyc7w5MrB8qE7hH9C7tuV1paSG1346xwOGcjvwMwHXI5BA3/W9rEq6GSKsQSOWa1kmo79Ok6A== X-Received: by 2002:a63:6116:: with SMTP id v22mr27612362pgb.272.1556604229153; Mon, 29 Apr 2019 23:03:49 -0700 (PDT) Received: from localhost (203-217-53-131.dyn.iinet.net.au. [203.217.53.131]) by smtp.gmail.com with ESMTPSA id i10sm77106882pfj.7.2019.04.29.23.03.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 29 Apr 2019 23:03:48 -0700 (PDT) From: Daniel Axtens To: patchwork@lists.ozlabs.org Subject: [PATCH 07/10] Add support for Django REST Framework 3.7, 3.8 Date: Tue, 30 Apr 2019 16:03:05 +1000 Message-Id: <20190430060308.10432-8-dja@axtens.net> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190430060308.10432-1-dja@axtens.net> References: <20190430060308.10432-1-dja@axtens.net> MIME-Version: 1.0 X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" From: Stephen Finucane No breaking changes that concern us here. Signed-off-by: Stephen Finucane Reviewed-by: Daniel Axtens Signed-off-by: Daniel Axtens (cherry picked from commit a27f36fb784867e434527b8e65064ae3bdb12c82) Signed-off-by: Daniel Axtens --- README.rst | 2 +- .../notes/django-rest-framework-3-7-bc6ad5df8bc54afc.yaml | 6 ++++++ .../notes/django-rest-framework-3-8-23865db833b4d188.yaml | 6 ++++++ requirements-dev.txt | 2 +- requirements-prod.txt | 2 +- tox.ini | 5 +++-- 6 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 releasenotes/notes/django-rest-framework-3-7-bc6ad5df8bc54afc.yaml create mode 100644 releasenotes/notes/django-rest-framework-3-8-23865db833b4d188.yaml diff --git a/README.rst b/README.rst index 4a970ec5a9ff..ddc4b98125d1 100644 --- a/README.rst +++ b/README.rst @@ -45,7 +45,7 @@ Requirements - Django (1.8 - 1.11) -- Django REST Framework (3.2 - 3.6) +- Django REST Framework (3.4 - 3.8) - Django Filters (1.0) diff --git a/releasenotes/notes/django-rest-framework-3-7-bc6ad5df8bc54afc.yaml b/releasenotes/notes/django-rest-framework-3-7-bc6ad5df8bc54afc.yaml new file mode 100644 index 000000000000..4bf92c999df5 --- /dev/null +++ b/releasenotes/notes/django-rest-framework-3-7-bc6ad5df8bc54afc.yaml @@ -0,0 +1,6 @@ +--- +upgrade: + - | + `Django REST Framework 3.7 + `_ is now + supported. diff --git a/releasenotes/notes/django-rest-framework-3-8-23865db833b4d188.yaml b/releasenotes/notes/django-rest-framework-3-8-23865db833b4d188.yaml new file mode 100644 index 000000000000..dc2d2c8f8bfa --- /dev/null +++ b/releasenotes/notes/django-rest-framework-3-8-23865db833b4d188.yaml @@ -0,0 +1,6 @@ +--- +upgrade: + - | + `Django REST Framework 3.8 + `_ is now + supported. diff --git a/requirements-dev.txt b/requirements-dev.txt index 7a8fdb9c8851..b12246dd1b89 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,4 +1,4 @@ Django>=1.8,<2.0 -djangorestframework>=3.4,<3.7 +djangorestframework>=3.4,<3.9 django-filter>=1.0,<1.1 -r requirements-test.txt diff --git a/requirements-prod.txt b/requirements-prod.txt index d249ad84c10c..42ff8ecd82f1 100644 --- a/requirements-prod.txt +++ b/requirements-prod.txt @@ -1,5 +1,5 @@ Django>=1.8,<2.0 -djangorestframework>=3.4,<3.7 +djangorestframework>=3.4,<3.9 django-filter>=1.0,<1.1 psycopg2>=2.7,<2.8 sqlparse==0.2.4 diff --git a/tox.ini b/tox.ini index 327b9e7c14a8..5c741d374a64 100644 --- a/tox.ini +++ b/tox.ini @@ -10,8 +10,9 @@ deps = django19: django>=1.9,<1.10 django110: django>=1.10,<1.11 django111: django>=1.11,<2.0 - django{18,19,110}: djangorestframework>=3.4,<3.7 - django111: djangorestframework>=3.6,<3.7 + django{18,19}: djangorestframework>=3.4,<3.7 + django110: djangorestframework>=3.4,<3.9 + django111: djangorestframework>=3.6,<3.9 django{18,19,110,111}: django-filter>=1.0,<1.1 setenv = DJANGO_SETTINGS_MODULE = patchwork.settings.dev From patchwork Tue Apr 30 06:03:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Axtens X-Patchwork-Id: 1093003 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44tWJ71bHzz9s7T for ; Tue, 30 Apr 2019 16:06:47 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=axtens.net Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=axtens.net header.i=@axtens.net header.b="TdBZm3gG"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 44tWJ70RKszDqMp for ; Tue, 30 Apr 2019 16:06:47 +1000 (AEST) X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=axtens.net (client-ip=2607:f8b0:4864:20::434; helo=mail-pf1-x434.google.com; envelope-from=dja@axtens.net; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=axtens.net Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=axtens.net header.i=@axtens.net header.b="TdBZm3gG"; dkim-atps=neutral Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 44tWDs0qkgzDqQX for ; Tue, 30 Apr 2019 16:03:56 +1000 (AEST) Received: by mail-pf1-x434.google.com with SMTP id z26so2654281pfg.6 for ; Mon, 29 Apr 2019 23:03:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axtens.net; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1PJJsmvRFtP/HM+IbBFqr+kBN7GACnvnkkW24NMRddA=; b=TdBZm3gGYFmSj7DtOhd87cKxZ/qIhs8Wc1A+STLTR4BVYLmMwX22HSxIYqMMYt2uMl 3n/v/bkQSqIlKG9/gcbvRMOMoI64N0i3VhF8+d4e88qEAX72wRgFYLxsdVbZWXzWSQAG pyocP6VuPWzEN1Rpv8h/j786tN/Pj/X70uPTI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1PJJsmvRFtP/HM+IbBFqr+kBN7GACnvnkkW24NMRddA=; b=HpIqigfcKYzZ5R/E4bpy6k5IF1/MN6keh7qU8p5lBVlfm8LQ2DFQPTubkeZm5mLj2r 4G7PpqaEyIN9iTKC3jRRZJKQ3FGTfBlJ0ltpOdMtZGSKLZXxenD5MawCgMeqHpygk4ND sa1gbbHpifYLqzDTFr90rmbIcqyzSO5KzQ8TxYCMDKpvdkjQyiiXqyeAbnn8952aIjhr 0U0tjPU7lhQajeSQTGDW9d/LKHfLr5k0e8ClhJ3c6zBc+lf3z1MTMAoyT4U9nTeHQ4TW bduZapuFoMvkZwHdmQGLCfEYUzXM+Ekv0Sen3fPeca1sPUfoH9iQUUO7hs+0qBe1XeI2 iyeQ== X-Gm-Message-State: APjAAAVItyO/kCxIc1l1w35QkmnJyKTlXMJ5YKiCRqybM4WG2odtdC4a 1w31JL3TMgLs44dKuh/6P3rpGGlBHuY= X-Google-Smtp-Source: APXvYqzYTSny2OeIMH7FakTAkJsAl6K5KRFCr7FT1wTjl/r7Gj1nO8BxGEKVNKvd/NxxqKtGkDrJOA== X-Received: by 2002:a62:2687:: with SMTP id m129mr23733079pfm.204.1556604233799; Mon, 29 Apr 2019 23:03:53 -0700 (PDT) Received: from localhost (203-217-53-131.dyn.iinet.net.au. [203.217.53.131]) by smtp.gmail.com with ESMTPSA id z12sm2229041pgc.88.2019.04.29.23.03.52 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 29 Apr 2019 23:03:53 -0700 (PDT) From: Daniel Axtens To: patchwork@lists.ozlabs.org Subject: [PATCH 08/10] Add support for django-filter 1.1 Date: Tue, 30 Apr 2019 16:03:06 +1000 Message-Id: <20190430060308.10432-9-dja@axtens.net> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190430060308.10432-1-dja@axtens.net> References: <20190430060308.10432-1-dja@axtens.net> MIME-Version: 1.0 X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" From: Stephen Finucane There's one warning to handle here. Signed-off-by: Stephen Finucane Signed-off-by: Daniel Axtens (cherry picked from commit 4ad2558f884bf33201e179a171ad3821a62126a1) Signed-off-by: Daniel Axtens --- README.rst | 2 +- patchwork/api/filters.py | 5 +++-- patchwork/compat.py | 16 ++++++++++++++++ .../django-filter-1-1-6a6b0ab8cbe0faca.yaml | 6 ++++++ requirements-dev.txt | 2 +- requirements-prod.txt | 2 +- tox.ini | 3 ++- 7 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 releasenotes/notes/django-filter-1-1-6a6b0ab8cbe0faca.yaml diff --git a/README.rst b/README.rst index ddc4b98125d1..94ac32c3b8b7 100644 --- a/README.rst +++ b/README.rst @@ -47,7 +47,7 @@ Requirements - Django REST Framework (3.4 - 3.8) -- Django Filters (1.0) +- Django Filters (1.0 - 1.1) Development Installation ------------------------ diff --git a/patchwork/api/filters.py b/patchwork/api/filters.py index 73353d900a94..ddf527fd837b 100644 --- a/patchwork/api/filters.py +++ b/patchwork/api/filters.py @@ -26,6 +26,7 @@ from django_filters import ModelMultipleChoiceFilter from django.forms import ModelMultipleChoiceField as BaseMultipleChoiceField from django.forms.widgets import MultipleHiddenInput +from patchwork.compat import NAME_FIELD from patchwork.models import Bundle from patchwork.models import Check from patchwork.models import CoverLetter @@ -151,8 +152,8 @@ class UserFilter(ModelMultipleChoiceFilter): class TimestampMixin(FilterSet): # TODO(stephenfin): These should filter on a 'updated_at' field instead - before = IsoDateTimeFilter(name='date', lookup_expr='lt') - since = IsoDateTimeFilter(name='date', lookup_expr='gte') + before = IsoDateTimeFilter(lookup_expr='lt', **{NAME_FIELD: 'date'}) + since = IsoDateTimeFilter(lookup_expr='gte', **{NAME_FIELD: 'date'}) class SeriesFilterSet(TimestampMixin, FilterSet): diff --git a/patchwork/compat.py b/patchwork/compat.py index 38caa4e861cf..3bbff447dbcb 100644 --- a/patchwork/compat.py +++ b/patchwork/compat.py @@ -41,6 +41,22 @@ if settings.ENABLE_REST_API: from rest_framework.filters import DjangoFilterBackend # noqa +# NAME_FIELD +# +# The django-filter library renamed 'Filter.name' to 'Filter.field_name' in +# 1.1. +# +# https://django-filter.readthedocs.io/en/master/guide/migration.html#migrating-to-2-0 + +if settings.ENABLE_REST_API: + import django_filters # noqa + + if django_filters.VERSION >= (1, 1): + NAME_FIELD = 'field_name' + else: + NAME_FIELD = 'name' + + # reverse, reverse_lazy # # The reverse and reverse_lazy functions have been moved to django.urls in diff --git a/releasenotes/notes/django-filter-1-1-6a6b0ab8cbe0faca.yaml b/releasenotes/notes/django-filter-1-1-6a6b0ab8cbe0faca.yaml new file mode 100644 index 000000000000..3beb9c0848ef --- /dev/null +++ b/releasenotes/notes/django-filter-1-1-6a6b0ab8cbe0faca.yaml @@ -0,0 +1,6 @@ +--- +upgrade: + - | + `django-filter 1.1 + `_ is + now supported. diff --git a/requirements-dev.txt b/requirements-dev.txt index b12246dd1b89..1d58df714290 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,4 +1,4 @@ Django>=1.8,<2.0 djangorestframework>=3.4,<3.9 -django-filter>=1.0,<1.1 +django-filter>=1.0,<1.2 -r requirements-test.txt diff --git a/requirements-prod.txt b/requirements-prod.txt index 42ff8ecd82f1..59e2c1e6ce53 100644 --- a/requirements-prod.txt +++ b/requirements-prod.txt @@ -1,5 +1,5 @@ Django>=1.8,<2.0 djangorestframework>=3.4,<3.9 -django-filter>=1.0,<1.1 +django-filter>=1.0,<1.2 psycopg2>=2.7,<2.8 sqlparse==0.2.4 diff --git a/tox.ini b/tox.ini index 5c741d374a64..c242c97f4d8b 100644 --- a/tox.ini +++ b/tox.ini @@ -13,7 +13,8 @@ deps = django{18,19}: djangorestframework>=3.4,<3.7 django110: djangorestframework>=3.4,<3.9 django111: djangorestframework>=3.6,<3.9 - django{18,19,110,111}: django-filter>=1.0,<1.1 + django18: django-filter>=1.0,<1.1 + django{19,110,111}: django-filter>=1.0,<1.2 setenv = DJANGO_SETTINGS_MODULE = patchwork.settings.dev PYTHONDONTWRITEBYTECODE = 1 From patchwork Tue Apr 30 06:03:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Axtens X-Patchwork-Id: 1093004 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44tWJM5hNqz9s7T for ; Tue, 30 Apr 2019 16:06:59 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=axtens.net Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=axtens.net header.i=@axtens.net header.b="qBjCPApG"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 44tWJM4RMdzDqMq for ; Tue, 30 Apr 2019 16:06:59 +1000 (AEST) X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=axtens.net (client-ip=2607:f8b0:4864:20::631; helo=mail-pl1-x631.google.com; envelope-from=dja@axtens.net; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=axtens.net Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=axtens.net header.i=@axtens.net header.b="qBjCPApG"; dkim-atps=neutral Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 44tWDx3X4kzDqR5 for ; Tue, 30 Apr 2019 16:04:01 +1000 (AEST) Received: by mail-pl1-x631.google.com with SMTP id w20so5616937plq.3 for ; Mon, 29 Apr 2019 23:04:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axtens.net; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZBAeDKFQZ4ZhGSSVIXaTR9B72FHQ1XDuvlU+AufEFw0=; b=qBjCPApG5l827yTANQB3UxW7s1op0EqXGuOPw/Os0ccRRdhy4/IlCkI5KgQCd3jRQd JFLcgX7ee55Fr3Dv7h9woCcoDx3HiC5fd1jtCEqOA6jL4zXarFmSm1A0WTgAjxuKvSMu qsrkxpUnenvOqGdmLLPaxoRShj+mPB1Pb/z8U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZBAeDKFQZ4ZhGSSVIXaTR9B72FHQ1XDuvlU+AufEFw0=; b=Eegx5AdztVSjnZmhcSgUs9isMir4vyjRlj2uuzSeAfur9lu7W6NdJoIv8piERxAqbC akYgPAb7MJLJTd0OTwQAdmuBPObahB5QXW/xifoDVnACnBANXsa27HCpCkNrs7lE4Q9S z3l4JCGw3licbs2MVtLA7eLCQ04s3k7Od/yumESVR2ouqp2aOmeZO1WyA1Hlilw3EVEb XcwPO82g/6pZanDndghuW6Ep+hRAtG+Po+kY+DkKG7HKidO1SsO1V4jeygqjFUi+M1x9 EeJCgdO1kOyrohryVsTjG9iffhQkbF/Qfezj49esvmal4z7wj2YIIBjWxaPtCcW1p3Nn ZxxQ== X-Gm-Message-State: APjAAAW9ZVEQgTktj5yE0Q+W0Uq0CvrsSHLQp9GneZpCNCqksKPh1a+N 4Pzu3VifTZN3nCPl9XnO+cZPeZYhstA= X-Google-Smtp-Source: APXvYqxcUI1gY/kNrK5Xt7JCg7nBV3gESSMk3joKWf2KdOJCtqQWbflK1g0HBB6R9Uo6bt2Klc6IHw== X-Received: by 2002:a17:902:b190:: with SMTP id s16mr28501028plr.83.1556604238815; Mon, 29 Apr 2019 23:03:58 -0700 (PDT) Received: from localhost (203-217-53-131.dyn.iinet.net.au. [203.217.53.131]) by smtp.gmail.com with ESMTPSA id b2sm30674870pff.63.2019.04.29.23.03.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 29 Apr 2019 23:03:58 -0700 (PDT) From: Daniel Axtens To: patchwork@lists.ozlabs.org Subject: [PATCH 09/10] Add support for Django REST Framework 3.9 Date: Tue, 30 Apr 2019 16:03:07 +1000 Message-Id: <20190430060308.10432-10-dja@axtens.net> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190430060308.10432-1-dja@axtens.net> References: <20190430060308.10432-1-dja@axtens.net> MIME-Version: 1.0 X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" From: Stephen Finucane As with 3.7 and 3.8, there are no breaking changes we need to be concerned with here. Signed-off-by: Stephen Finucane (backported from commit fab5571e2f20323feed84609a52778a0f8e41e32) Signed-off-by: Daniel Axtens --- .../notes/django-rest-framework-3-9-0afb78322dd82367.yaml | 6 ++++++ requirements-dev.txt | 2 +- requirements-prod.txt | 2 +- tox.ini | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 releasenotes/notes/django-rest-framework-3-9-0afb78322dd82367.yaml diff --git a/releasenotes/notes/django-rest-framework-3-9-0afb78322dd82367.yaml b/releasenotes/notes/django-rest-framework-3-9-0afb78322dd82367.yaml new file mode 100644 index 000000000000..e65531808d37 --- /dev/null +++ b/releasenotes/notes/django-rest-framework-3-9-0afb78322dd82367.yaml @@ -0,0 +1,6 @@ +--- +upgrade: + - | + `Django REST Framework 3.9 + `_ is now + supported. diff --git a/requirements-dev.txt b/requirements-dev.txt index 1d58df714290..9ea10e82e695 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,4 +1,4 @@ Django>=1.8,<2.0 -djangorestframework>=3.4,<3.9 +djangorestframework>=3.4,<3.10 django-filter>=1.0,<1.2 -r requirements-test.txt diff --git a/requirements-prod.txt b/requirements-prod.txt index 59e2c1e6ce53..9b56773b2a63 100644 --- a/requirements-prod.txt +++ b/requirements-prod.txt @@ -1,5 +1,5 @@ Django>=1.8,<2.0 -djangorestframework>=3.4,<3.9 +djangorestframework>=3.4,<3.10 django-filter>=1.0,<1.2 psycopg2>=2.7,<2.8 sqlparse==0.2.4 diff --git a/tox.ini b/tox.ini index c242c97f4d8b..ed9e77f961e3 100644 --- a/tox.ini +++ b/tox.ini @@ -12,7 +12,7 @@ deps = django111: django>=1.11,<2.0 django{18,19}: djangorestframework>=3.4,<3.7 django110: djangorestframework>=3.4,<3.9 - django111: djangorestframework>=3.6,<3.9 + django111: djangorestframework>=3.6,<3.10 django18: django-filter>=1.0,<1.1 django{19,110,111}: django-filter>=1.0,<1.2 setenv = From patchwork Tue Apr 30 06:03:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Axtens X-Patchwork-Id: 1093005 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44tWJd0rwGz9sB8 for ; Tue, 30 Apr 2019 16:07:13 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=axtens.net Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=axtens.net header.i=@axtens.net header.b="SV9PTF7U"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 44tWJc759rzDqRh for ; Tue, 30 Apr 2019 16:07:12 +1000 (AEST) X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=axtens.net (client-ip=2607:f8b0:4864:20::441; helo=mail-pf1-x441.google.com; envelope-from=dja@axtens.net; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=axtens.net Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=axtens.net header.i=@axtens.net header.b="SV9PTF7U"; dkim-atps=neutral Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 44tWF12nYpzDqQV for ; Tue, 30 Apr 2019 16:04:05 +1000 (AEST) Received: by mail-pf1-x441.google.com with SMTP id g3so6543209pfi.4 for ; Mon, 29 Apr 2019 23:04:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axtens.net; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LUZEutW5MItSCJ225o4/Vy76T0OEUeA4Azl7bTDut6c=; b=SV9PTF7UII7hsnSXufrDORFci4yCFFCQ38LbJr+YeDn0Z7CJfVWyp1G6/OXABwEgVR xVp55mS/3vIEhcshsKRr5n9dWrXt/o2BBabPxIli1frMSMsgXZn+TEeBB4qmgeuxMaKX Ws9YHtykdZ/l3gfIuoZ4SPOARxiChUu6itUD4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LUZEutW5MItSCJ225o4/Vy76T0OEUeA4Azl7bTDut6c=; b=r21xyE9MhmTOrET8J6Q6H0+VkqLFjaPO4wmskyeR6Il68mSTt98vJx9OyhDi19fHFO XX/rKdEg6dAKPQjkUoiow3uCEIOTg7Q4iq5NM4PSndo3SKKk2vayy+UYE2AfHajXYWSf lLd1i+YlDXRm98kz4Cih7GHZvQlXgRHO6sIBvvG3D6IOtr6cbXZ601ah44wtl/fmo4bn pFqQWIb8lGr3nIbTLd7KD8u1TC7FMpvDqkiWEeOCFD27ykaNMmdVq2Iw9+UGhmYN6Hul +K/pVEi2U58H19HsKSzhppYv8pQFyUJ6nBgNbUXEcQ4lmWJ+fg3U+JUeFDZw9DCsEBrM yzRA== X-Gm-Message-State: APjAAAW8cq5R6g5FiodVMZ8DglSksqSl20eKiYpiBNroei68NTFgW/KW TMSGU5oOt+4A5LFIJgp02UCWGiSOVXI= X-Google-Smtp-Source: APXvYqzyr1exmRNeGTaOneFtBOImI2KKZFrXrRGNFGJc14/kW/wdSZSqUkdgjuYci+bcZmi0qrnnXA== X-Received: by 2002:a63:5b24:: with SMTP id p36mr61806478pgb.84.1556604243164; Mon, 29 Apr 2019 23:04:03 -0700 (PDT) Received: from localhost (203-217-53-131.dyn.iinet.net.au. [203.217.53.131]) by smtp.gmail.com with ESMTPSA id b20sm19626742pff.118.2019.04.29.23.04.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 29 Apr 2019 23:04:02 -0700 (PDT) From: Daniel Axtens To: patchwork@lists.ozlabs.org Subject: [PATCH 10/10] Release 2.1.2 Date: Tue, 30 Apr 2019 16:03:08 +1000 Message-Id: <20190430060308.10432-11-dja@axtens.net> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190430060308.10432-1-dja@axtens.net> References: <20190430060308.10432-1-dja@axtens.net> MIME-Version: 1.0 X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" Signed-off-by: Daniel Axtens --- patchwork/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patchwork/__init__.py b/patchwork/__init__.py index 72416b32a073..241f496cf71f 100644 --- a/patchwork/__init__.py +++ b/patchwork/__init__.py @@ -19,7 +19,7 @@ from patchwork.version import get_latest_version -VERSION = (2, 1, 2, 'alpha', 0) +VERSION = (2, 1, 2) __version__ = get_latest_version(VERSION)