core.bones.uri ============== .. py:module:: core.bones.uri Attributes ---------- .. autoapisummary:: core.bones.uri.PORT_MIN core.bones.uri.PORT_MAX Classes ------- .. autoapisummary:: core.bones.uri.UriBone Module Contents --------------- .. py:data:: PORT_MIN :type: Final[int] :value: 1 .. py:data:: PORT_MAX :type: Final[int] :value: 65535 .. py:class:: UriBone(*, accepted_protocols = None, accepted_ports = None, clean_get_params = False, domain_allowed_list = None, domain_disallowed_list = None, local_path_allowed = False, **kwargs) Bases: :py:obj:`core.bones.base.BaseBone` The BaseBone class serves as the base class for all bone types in the ViUR framework. It defines the core functionality and properties that all bones should implement. :param descr: Textual, human-readable description of that bone. Will be translated. :param defaultValue: If set, this bone will be preinitialized with this value :param required: If True, the user must enter a valid value for this bone (the viur.core refuses to save the skeleton otherwise). If a list/tuple of languages (strings) is provided, these language must be entered. :param multiple: If True, multiple values can be given. (ie. n:m relations instead of n:1) :param searchable: If True, this bone will be included in the fulltext search. Can be used without the need of also been indexed. :param type_suffix: Allows to specify an optional suffix for the bone-type, for bone customization :param vfunc: If given, a callable validating the user-supplied value for this bone. This callable must return None if the value is valid, a String containing an meaningful error-message for the user otherwise. :param readOnly: If True, the user is unable to change the value of this bone. If a value for this bone is given along the POST-Request during Add/Edit, this value will be ignored. Its still possible for the developer to modify this value by assigning skel.bone.value. :param visible: If False, the value of this bone should be hidden from the user. This does *not* protect the value from being exposed in a template, nor from being transferred to the client (ie to the admin or as hidden-value in html-form) :param compute: If set, the bone's value will be computed in the given method. .. NOTE:: The kwarg 'multiple' is not supported by all bones The UriBone is used for storing URI and URL. :param accepted_protocols: The accepted protocols can be set to allow only the provide protocols. :param accepted_ports The accepted ports can be set to allow only the provide ports. .. code-block:: python # Example UriBone(accepted_ports=1) UriBone(accepted_ports="2") UriBone(accepted_ports="1-4") UriBone(accepted_ports=(1,"2","4-10")) :param clean_get_params: When set to True, the GET-parameter for the URL will be cleaned. :param domain_allowed_list: If set, only the URLs that are matched with an entry of this iterable will be accepted. :param domain_disallowed_list: If set, only the URLs that are not matched with an entry of this iterable will be accepted. :param local_path_allowed: If True, the URLs that are local paths will be prefixed with "/". .. py:attribute:: type :value: 'uri' .. py:attribute:: accepted_protocols :value: None .. py:attribute:: clean_get_params :value: False .. py:attribute:: domain_allowed_list :value: None .. py:attribute:: domain_disallowed_list :value: None .. py:attribute:: local_path_allowed :value: False .. py:method:: _build_accepted_ports(accepted_ports) :classmethod: .. py:method:: isInvalid(value) Checks if the current value of the bone in the given skeleton is invalid. Returns None if the value would be valid for this bone, an error-message otherwise. .. py:method:: singleValueFromClient(value, skel, bone_name, client_data) Load a single value from a client :param value: The single value which should be loaded. :param skel: The SkeletonInstance where the value should be loaded into. :param bone_name: The bone name of this bone in the SkeletonInstance. :param client_data: The data taken from the client, a dictionary with usually bone names as key :return: A tuple. If the value is valid, the first element is the parsed value and the second is None. If the value is invalid or not parseable, the first element is a empty value and the second a list of *ReadFromClientError*. .. py:method:: structure() Describes the bone and its settings as an JSON-serializable dict. This function has to be implemented for subsequent, specialized bone types.