From 0f981634bfa58f9858c7d97b6dd52c0ce1326a23 Mon Sep 17 00:00:00 2001 From: Kevin Deldycke Date: Wed, 20 Jul 2016 17:33:21 +0200 Subject: [PATCH] Only enforce minimal length requirement if min_length is unset. --- cassandra/cqlengine/columns.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cassandra/cqlengine/columns.py b/cassandra/cqlengine/columns.py index d13ad49a..13c21575 100644 --- a/cassandra/cqlengine/columns.py +++ b/cassandra/cqlengine/columns.py @@ -328,7 +328,9 @@ class Text(Column): Defaults to 1 if this is a ``required`` column. Otherwise, None. :param int max_length: Sets the maximum length of this string, for validation purposes. """ - self.min_length = min_length or (1 if kwargs.get('required', False) else None) + self.min_length = ( + 1 if not min_length and kwargs.get('required', False) + else min_length) self.max_length = max_length if self.min_length is not None: