From 690ea992d1ec8f98042f8d5dfbe7e783b6911436 Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Tue, 1 Oct 2019 13:33:12 +0200 Subject: [PATCH 1/2] schema: add Cube.warnings support (#36576) --- bijoe/schemas.py | 6 +++++- tests/fixtures/schema1/01_schema.json | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/bijoe/schemas.py b/bijoe/schemas.py index 20f73ee..856f0ab 100644 --- a/bijoe/schemas.py +++ b/bijoe/schemas.py @@ -20,6 +20,8 @@ import datetime import decimal import collections +from django.utils import six + from .relative_time import RelativeDate Point = collections.namedtuple('Point', ['x', 'y']) @@ -321,7 +323,7 @@ class Join(Base): class Cube(Base): __slots__ = ['name', 'label', 'fact_table', 'json_field', 'key', 'joins', 'dimensions', - 'measures'] + 'measures', 'warnings'] __types__ = { 'name': str, 'label': unicode, @@ -331,12 +333,14 @@ class Cube(Base): 'joins': [Join], 'dimensions': [Dimension], 'measures': [Measure], + 'warnings': [six.text_type], } json_field = None joins = () dimensions = () measures = () + warnings = () def check(self): names = collections.Counter() diff --git a/tests/fixtures/schema1/01_schema.json b/tests/fixtures/schema1/01_schema.json index 59e3520..1cce1c5 100644 --- a/tests/fixtures/schema1/01_schema.json +++ b/tests/fixtures/schema1/01_schema.json @@ -9,6 +9,7 @@ "label": "Facts 1", "fact_table": "\"Facts\"", "key": "id", + "warnings": ["le champ « pouët » n'est pas bon", "warning2"], "joins": [ { "name": "innersubcategory", -- 2.23.0