core.bones.spam =============== .. py:module:: core.bones.spam Classes ------- .. autoapisummary:: core.bones.spam.SpamBone Module Contents --------------- .. py:class:: SpamBone(descr = i18n.translate('core.bones.spam.question', 'What is the result of the addition of {{a}} and {{b}}?'), values = tuple((i18n.translate(f'core.bones.spam.value.{digit}', digit) for digit in ('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'))), required = True, msg_invalid = i18n.translate('core.bones.spam.invalid', 'Your answer was wrong! Please try again.'), **kwargs) Bases: :py:obj:`viur.core.bones.NumericBone` A bone for storing numeric values, either integers or floats. For floats, the precision can be specified in decimal-places. Initializes a new NumericBone. :param min: Minimum accepted value (including). :param max: Maximum accepted value (including). :param precision: How may decimal places should be saved. Zero casts the value to int instead of float. .. py:attribute:: type :value: 'numeric.spam' .. py:attribute:: values .. py:attribute:: descr_template .. py:attribute:: msg_invalid .. py:method:: _dice() .. py:property:: descr The descr-property is generated and uses session variables to construct the question. .. py:method:: isInvalid(value) This method checks if a given value is invalid (e.g., NaN) for the NumericBone instance. :param value: The value to be checked for validity. :return: Returns a string "NaN not allowed" if the value is invalid (NaN), otherwise None.