コード例 #1
0
    def invokeadaptermethod(self, adapter_id, method_name, **data):
        """
        Public web method, to be used when invoking specific 
        methods from external Adapters/Algorithms.
        """
        algo_group = self.flow_service.get_algo_group_by_identifier(adapter_id)
        try:
            adapter_instance = self.flow_service.build_adapter_instance(
                algo_group)
            result = self.flow_service.fire_operation(
                adapter_instance, common.get_logged_user(),
                common.get_current_project().id, method_name, **data)
            common.set_info_message("Submit OK!")
            if isinstance(adapter_instance, ABCDisplayer) and isinstance(
                    result, dict):
                common.pop_message_from_session()
                result[ABCDisplayer.KEY_IS_ADAPTER] = True
                result[common.KEY_DISPLAY_MENU] = True
                result[common.KEY_OPERATION_ID] = adapter_instance.operation_id
                result[common.KEY_ADAPTER] = adapter_id
                if KEY_CONTROLLS not in result:
                    result[KEY_CONTROLLS] = None
                self._populate_section(algo_group, result)
                return self.fill_default_attributes(result,
                                                    algo_group.displayname)

        except OperationException, excep:
            common.set_warning_message('Problem when submitting data!')
            self.logger.error(
                "Invalid method, or wrong  parameters when invoking external method on post!"
            )
            self.logger.exception(excep)
コード例 #2
0
    def invokeadaptermethod(self, adapter_id, method_name, **data):
        """
        Public web method, to be used when invoking specific 
        methods from external Adapters/Algorithms.
        """
        algo_group = self.flow_service.get_algo_group_by_identifier(adapter_id)
        try:
            adapter_instance = self.flow_service.build_adapter_instance(algo_group)
            result = self.flow_service.fire_operation(adapter_instance, common.get_logged_user(),
                                                      common.get_current_project().id, method_name, **data)
            common.set_info_message("Submit OK!")
            if isinstance(adapter_instance, ABCDisplayer) and isinstance(result, dict):
                common.pop_message_from_session()
                result[ABCDisplayer.KEY_IS_ADAPTER] = True
                result[common.KEY_DISPLAY_MENU] = True
                result[common.KEY_OPERATION_ID] = adapter_instance.operation_id
                result[common.KEY_ADAPTER] = adapter_id
                if KEY_CONTROLLS not in result:
                    result[KEY_CONTROLLS] = None
                self._populate_section(algo_group, result)
                return self.fill_default_attributes(result, algo_group.displayname)

        except OperationException, excep:
            common.set_warning_message('Problem when submitting data!')
            self.logger.error("Invalid method, or wrong  parameters when invoking external method on post!")
            self.logger.exception(excep)
コード例 #3
0
 def _populate_message(template_dictionary):
     """
      Populate the template dictionary with current message stored in session. 
      Also specify the message type (default INFO).
      Clear from session current message (to avoid displaying it twice).
      """
     msg = common.pop_message_from_session()
     template_dictionary.update(msg)
     return template_dictionary
コード例 #4
0
 def _populate_message(template_dictionary):
     """
      Populate the template dictionary with current message stored in session. 
      Also specify the message type (default INFO).
      Clear from session current message (to avoid displaying it twice).
      """
     msg = common.pop_message_from_session()
     template_dictionary.update(msg)
     return template_dictionary