Пример #1
0
    def get_field(self, field_name):
        """Get field instance used to get, set, and serialize internal field value

        Returns:
            Field: Requested field instance

        Raises:
             UnknownField: Raised if `field_name` not found in parent App
        """
        try:
            return self._fields[field_name]
        except KeyError:
            raise UnknownField(self._app, field_name, self._fields.keys())
Пример #2
0
    def get_field(self, field_name):
        """Get field instance used to get, set, and serialize internal field value

        Args:
            field_name (str): Field name or key to retrieve

        Returns:
            Field: Requested field instance

        Raises:
             UnknownField: Raised if `field_name` not found in parent App
        """
        try:
            return self._fields[self.app.resolve_field_name(field_name)]
        except KeyError:
            raise UnknownField(self.app, field_name, self._fields.keys())
Пример #3
0
    def get_field_definition_by_id(self, field_id):
        """Get JSON field definition for field matching provided id

        Args:
            field_id (str): Target field ID to get definition for

        Raises:
            swimlane.exceptions.UnknownField: Raised when given a field ID not found in App

        Returns:
            dict: Field metadata definition
        """
        try:
            return self._fields_by_id[field_id]
        except KeyError:
            raise UnknownField(self, field_id, self._fields_by_id.keys())
Пример #4
0
    def get_field_definition_by_name(self, field_name):
        """Get JSON field definition for field matching provided name or key

        .. versionchanged:: 4.1.0
            Added support for field keys

        Args:
            field_name (str): Target field name or key to get definition for

        Raises:
            swimlane.exceptions.UnknownField: Raised when given a field name not found in App

        Returns:
            dict: Field metadata definition
        """
        try:
            return self._fields_by_name[self.resolve_field_name(field_name)]
        except KeyError:
            raise UnknownField(self, field_name, self._fields_by_name.keys())