[IMP] fields: add warning for field attributes select and digits_compute

This commit is contained in:
Raphael Collet
2016-10-24 12:27:33 +02:00
parent 9a75c6d608
commit cae04ba1d3
+8
View File
@@ -26,6 +26,8 @@ DATE_LENGTH = len(date.today().strftime(DATE_FORMAT))
DATETIME_LENGTH = len(datetime.now().strftime(DATETIME_FORMAT))
EMPTY_DICT = frozendict()
RENAMED_ATTRS = [('select', 'index'), ('digits_compute', 'digits')]
_logger = logging.getLogger(__name__)
_schema = logging.getLogger(__name__[:-7] + '.schema')
@@ -453,6 +455,12 @@ class Field(object):
if not attrs.get('readonly'):
attrs['inverse'] = self._inverse_sparse
# check for renamed attributes (conversion errors)
for key1, key2 in RENAMED_ATTRS:
if key1 in attrs:
_logger.warning("Field %s: parameter %r is no longer supported; use %r instead.",
self, key1, key2)
self.set_all_attrs(attrs)
# prefetch only stored, column, non-manual and non-deprecated fields