summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql
diff options
context:
space:
mode:
authorsanjana <sanjana0796@gmail.com>2019-02-13 10:17:46 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2019-02-13 17:29:13 -0500
commit12dad561a77506fe262d791d3135babc0be50e66 (patch)
treec60ca8c1edab121ae45455bb10338909595a90b0 /lib/sqlalchemy/sql
parent5cc5234e0b065907deb2765249dde1c526fe5c89 (diff)
downloadsqlalchemy-12dad561a77506fe262d791d3135babc0be50e66.tar.gz
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
Diffstat (limited to 'lib/sqlalchemy/sql')
-rw-r--r--lib/sqlalchemy/sql/sqltypes.py5
1 files changed, 5 insertions, 0 deletions
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)