From 12dad561a77506fe262d791d3135babc0be50e66 Mon Sep 17 00:00:00 2001 From: sanjana Date: Wed, 13 Feb 2019 10:17:46 -0500 Subject: Adding setter to should_evaluate_none property Fixed issue where the :class:`.JSON` type had a read-only :attr:`.JSON.should_evaluate_none` attribute, which would cause failures when making use of the :meth:`.TypeEngine.evaluates_none` method in conjunction with this type. Pull request courtesy Sanjana S. Fixes: #4485 Closes: #4496 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4496 Pull-request-sha: 044beb23982d411be6fe640716b1b693df0f7189 Change-Id: I1f3e1d7dec9d2ceb6ccaaa8cac158a062cf02710 --- lib/sqlalchemy/sql/sqltypes.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/sqlalchemy/sql') diff --git a/lib/sqlalchemy/sql/sqltypes.py b/lib/sqlalchemy/sql/sqltypes.py index 8798f5ad7..0d3944552 100644 --- a/lib/sqlalchemy/sql/sqltypes.py +++ b/lib/sqlalchemy/sql/sqltypes.py @@ -2214,8 +2214,13 @@ class JSON(Indexable, TypeEngine): @property def should_evaluate_none(self): + """Alias of :attr:`.JSON.none_as_null`""" return not self.none_as_null + @should_evaluate_none.setter + def should_evaluate_none(self, value): + self.none_as_null = not value + @util.memoized_property def _str_impl(self): return String(_expect_unicode=True) -- cgit v1.2.1