Remove now superfluous special cases.

Removes `verbose_name`, `help_text`, and `custom_data`.  All three are
covered by the one metadata assignment and will continue working as
expected.
This commit is contained in:
Alice Bevan–McGregor 2015-10-13 21:59:29 -04:00
parent e049cef00a
commit d133913c3d

View File

@ -41,8 +41,7 @@ class BaseField(object):
def __init__(self, db_field=None, name=None, required=False, default=None, def __init__(self, db_field=None, name=None, required=False, default=None,
unique=False, unique_with=None, primary_key=False, unique=False, unique_with=None, primary_key=False,
validation=None, choices=None, verbose_name=None, validation=None, choices=None, null=False, sparse=False,
help_text=None, null=False, sparse=False, custom_data=None
**kwargs): **kwargs):
""" """
:param db_field: The database field to store this field in :param db_field: The database field to store this field in
@ -61,16 +60,10 @@ class BaseField(object):
field. Generally this is deprecated in favour of the field. Generally this is deprecated in favour of the
`FIELD.validate` method `FIELD.validate` method
:param choices: (optional) The valid choices :param choices: (optional) The valid choices
:param verbose_name: (optional) The verbose name for the field.
Designed to be human readable and is often used when generating
model forms from the document model.
:param help_text: (optional) The help text for this field and is often
used when generating model forms from the document model.
:param null: (optional) Is the field value can be null. If no and there is a default value :param null: (optional) Is the field value can be null. If no and there is a default value
then the default value is set then the default value is set
:param sparse: (optional) `sparse=True` combined with `unique=True` and `required=False` :param sparse: (optional) `sparse=True` combined with `unique=True` and `required=False`
means that uniqueness won't be enforced for `None` values means that uniqueness won't be enforced for `None` values
:param custom_data: (optional) Custom metadata for this field.
:param **kwargs: (optional) Arbitrary indirection-free metadata for this field. :param **kwargs: (optional) Arbitrary indirection-free metadata for this field.
""" """
self.db_field = (db_field or name) if not primary_key else '_id' self.db_field = (db_field or name) if not primary_key else '_id'
@ -85,12 +78,9 @@ class BaseField(object):
self.primary_key = primary_key self.primary_key = primary_key
self.validation = validation self.validation = validation
self.choices = choices self.choices = choices
self.verbose_name = verbose_name
self.help_text = help_text
self.null = null self.null = null
self.sparse = sparse self.sparse = sparse
self._owner_document = None self._owner_document = None
self.custom_data = custom_data
conflicts = set(dir(self)).intersect(kwargs) conflicts = set(dir(self)).intersect(kwargs)
if conflicts: if conflicts: