예제 #1
0
    def get_model_info(self, model, mode='docs'):
        """View the details of an action or a plan.

        :param model: An Action or Plan instance.
        :type model: _hoomanlife.models.Action, _hoomanlife.models.Plan
        :param mode: The view mode: 'all' for properties and docs, 'props' for properties, and 'docs' for docs.
        :type mode: str
        :rules mode: in ['all', 'props', 'docs']
        """

        if mode == 'props':
            return dal._properties_to_json(model)
        elif mode == 'docs':
            return '\n'.join(model.docs)
        else:
            output = dal._properties_to_json(model)
            output += '\n' + '\n'.join(model.docs)
            return output
예제 #2
0
    def get_model_info(self, model, mode='docs'):
        """View the details of an action or a plan.

        :param model: An Action or Plan instance.
        :type model: _hoomanlife.models.Action, _hoomanlife.models.Plan
        :param mode: The view mode: 'all' for properties and docs, 'props' for properties, and 'docs' for docs.
        :type mode: str
        :rules mode: in ['all', 'props', 'docs']
        """

        if mode == 'props':
            return dal._properties_to_json(model)
        elif mode == 'docs':
            return '\n'.join(model.docs)
        else:
            output = dal._properties_to_json(model)
            output += '\n' + '\n'.join(model.docs)
            return output