From f630661ceaf1b2c2ef747e7d1eb03a69ca51d0cd Mon Sep 17 00:00:00 2001 From: Idan Date: Thu, 8 Jun 2017 12:08:59 +0000 Subject: [PATCH] Add field's properties documentation. Change-Id: Ic2951378b8039945dab5c7521ac7a8b98ca3f7e2 --- glare/objects/meta/wrappers.py | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/glare/objects/meta/wrappers.py b/glare/objects/meta/wrappers.py index 1fafa73..64b8e38 100644 --- a/glare/objects/meta/wrappers.py +++ b/glare/objects/meta/wrappers.py @@ -31,7 +31,30 @@ class Field(object): def __init__(self, field_class, mutable=False, required_on_activate=True, system=False, validators=None, nullable=True, default=None, sortable=False, filter_ops=None, description=""): - """Init and validate field.""" + """Init and validate field. + Each artifact field has several common properties: + + :param required_on_activate: boolean value indicating if the field + value should be specified for the artifact + before activation (Default:True). + :param mutable: boolean value indicating if the field value may + be changed after the artifact is activated. (Default: False) + :param system: boolean value indicating if the field + value cannot be edited by user (Default: False). + :param sortable: boolean value indicating if there is a possibility + to sort by this fields's values. (Default: False) Only fields of + 4 primitive types may be sortable: integer, string, float and boolean. + :param default: a default value for the field may be specified + (Default: None). + :param validators: a list of objects. When user sets a value to + the field with additional validators Glare checks them before setting + the value and raises ValueError if at least one of the requirements + is not satisfied. + :param filter_ops: a list of available filter operators for the field. + There are seven available operators: + 'eq', 'neq', 'lt', 'lte', 'gt', 'gte', 'in'. + """ + if not issubclass(field_class, fields.AutoTypedField): raise exc.IncorrectArtifactType( "Field class %s must be sub-class of AutoTypedField." %