From nobody Tue May 13 19:36:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=patchew-devel-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 153460144720472.36842307715324; Sat, 18 Aug 2018 07:10:47 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AB13A3084216; Sat, 18 Aug 2018 14:10:42 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 981E9709E5; Sat, 18 Aug 2018 14:10:42 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7FE3E4A460; Sat, 18 Aug 2018 14:10:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w7IEAepL020399 for ; Sat, 18 Aug 2018 10:10:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id C137F308BDA2; Sat, 18 Aug 2018 14:10:40 +0000 (UTC) Received: from mx1.redhat.com (ext-mx07.extmail.prod.ext.phx2.redhat.com [10.5.110.31]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B8181308BDA0 for ; Sat, 18 Aug 2018 14:10:38 +0000 (UTC) Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 72943C049E0F for ; Sat, 18 Aug 2018 14:10:37 +0000 (UTC) Received: by mail-wm0-f66.google.com with SMTP id y9-v6so9830596wma.5 for ; Sat, 18 Aug 2018 07:10:37 -0700 (PDT) Received: from donizetti.lan (dynamic-adsl-78-12-184-244.clienti.tiscali.it. [78.12.184.244]) by smtp.gmail.com with ESMTPSA id g2-v6sm13874652wrd.71.2018.08.18.07.10.34 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 18 Aug 2018 07:10:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=lSuokkjRt+cYuItR+EKJPwUD4p1ys6Mu/dAUXdpiOlg=; b=IQT/JzYlCmhD7LWk5XlrHzMAkumFGGYxvKL7U5UN6y3Mmu1lGZ0rdaV08PwLjGKcvJ 7/0bz1IdSJ2Kc9+oF7LuhgPMiDEDhLef3ag0YWl3srKSATaGV3Jebh3XhvKa/hxuK9IU K6+NZzcKvpVnhPeis5NVpuQTpMloeJmXeNAF1CWyDh8TiA2KnCpB5lN5crfbAU6mXQop fnoby/WJEMoDBdevoZhksXxyjXQ8ihA2YL1U8qBn+mgCrdqLl7MA282O2zZxD/VKr4za wAU/s3QQCwOAYIfnCptaIPQm+614fBpz60eMUOydDnU+bx33DTjZ0zE6wilswyLAk3oo iG3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=lSuokkjRt+cYuItR+EKJPwUD4p1ys6Mu/dAUXdpiOlg=; b=p475G1ETzkjC8TyGtvtLm0KRVMZ0DFQJNgnmNm+7klwkesEjJf/n17shKSOS1g276H SxhrMmL4ryPwQONwBJHWt8GIkFpjpC29cSAYSPeCp6I6kV/jXdX9OeGTOaczpoWQkwp1 rUJpKB43IEEGXxKeT2/eFthtYCpcz+eDFupnRgSwjz9I8Q24BHFJCZJdosynGzY/YwOi 8VX/YevIcyIyaarHN/GGsOZxf58uk4JeduGGKy1ZnjtiPi1IdjecPzFz2ZmZYGRTbLZ9 43EEGWOovJfBac14MxLa00SY1IdIhYWiYPoQpSmYw0fzjJrkzq/YuvIuKwsofH6YTfAQ OwoA== X-Gm-Message-State: AOUpUlEu/AT4Q9GutL+7gxM/sFntBFEE510hmpGIik0nInGxhYn0QymY PubWtCkgeN55ZNmuhTRLdbpf04QC X-Google-Smtp-Source: AA+uWPyjyx41ixDmTk2EbPhAyMpFz4edPKYO9A3lX/6DV2yMVtCJ1ZSx/C2LXwnJHmjCYv3pj2kiiQ== X-Received: by 2002:a1c:e043:: with SMTP id x64-v6mr21564753wmg.58.1534601435849; Sat, 18 Aug 2018 07:10:35 -0700 (PDT) From: Paolo Bonzini To: patchew-devel@redhat.com Date: Sat, 18 Aug 2018 16:10:25 +0200 Message-Id: <20180818141033.29752-2-pbonzini@redhat.com> In-Reply-To: <20180818141033.29752-1-pbonzini@redhat.com> References: <20180818141033.29752-1-pbonzini@redhat.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Sat, 18 Aug 2018 14:10:37 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Sat, 18 Aug 2018 14:10:37 +0000 (UTC) for IP:'74.125.82.66' DOMAIN:'mail-wm0-f66.google.com' HELO:'mail-wm0-f66.google.com' FROM:'paolo.bonzini@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.028 (DKIM_SIGNED, DKIM_VALID, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 74.125.82.66 mail-wm0-f66.google.com 74.125.82.66 mail-wm0-f66.google.com X-RedHat-Possible-Forgery: Paolo Bonzini X-Scanned-By: MIMEDefang 2.78 on 10.5.110.31 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.24 X-loop: patchew-devel@redhat.com Subject: [Patchew-devel] [PATCH 1/9] models: JSONField default should be empty dictionary, not empty string X-BeenThere: patchew-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Patchew development and discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: patchew-devel-bounces@redhat.com Errors-To: patchew-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Sat, 18 Aug 2018 14:10:42 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_0 RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Otherwise, you could have a situation the REST API returns an empty string for a GET request, but JSONField complains when the same empty string is passed as a PUT request. Signed-off-by: Paolo Bonzini --- api/migrations/0033_auto_20180803_0809.py | 22 ++++++++++++++++++++++ api/models.py | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 api/migrations/0033_auto_20180803_0809.py diff --git a/api/migrations/0033_auto_20180803_0809.py b/api/migrations/003= 3_auto_20180803_0809.py new file mode 100644 index 0000000..12753cd --- /dev/null +++ b/api/migrations/0033_auto_20180803_0809.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.13 on 2018-08-03 08:09 +from __future__ import unicode_literals + +from django.db import migrations +import jsonfield.encoder +import jsonfield.fields + + +class Migration(migrations.Migration): + + dependencies =3D [ + ('api', '0032_fix_git_results'), + ] + + operations =3D [ + migrations.AlterField( + model_name=3D'result', + name=3D'data', + field=3Djsonfield.fields.JSONField(default=3D{}, dump_kwargs= =3D{'cls': jsonfield.encoder.JSONEncoder, 'separators': (',', ':')}, load_k= wargs=3D{}), + ), + ] diff --git a/api/models.py b/api/models.py index ad89cf8..eea924f 100644 --- a/api/models.py +++ b/api/models.py @@ -56,7 +56,7 @@ class Result(models.Model): code=3D'invalid')]) log_entry =3D models.OneToOneField(LogEntry, on_delete=3Dmodels.CASCAD= E, null=3DTrue) - data =3D jsonfield.JSONField() + data =3D jsonfield.JSONField(default=3D{}) =20 class Meta: index_together =3D [('status', 'name')] --=20 2.17.1 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel