コード例 #1
0
ファイル: scheduler.py プロジェクト: brtsz/zato
 def handle(self, *args, **kwargs):
     
     with closing(self.server.odb.session()) as session:
         
         params = _get_params(kwargs.get('payload'), ['cluster_id'], 'data.')
         definition_list = Element('definition_list')
         definitions = job_list(session, params['cluster_id'])
         
         for definition in definitions:
 
             definition_elem = Element('definition')
             definition_elem.id = definition.id
             definition_elem.name = definition.name
             definition_elem.is_active = definition.is_active
             definition_elem.job_type = definition.job_type
             definition_elem.start_date = definition.start_date
             definition_elem.extra = definition.extra.decode('utf-8')
             definition_elem.service_id = definition.service_id
             definition_elem.service_name = definition.service_name.decode('utf-8')
             definition_elem.weeks = definition.weeks if definition.weeks else ''
             definition_elem.days = definition.days if definition.days else ''
             definition_elem.hours = definition.hours if definition.hours else ''
             definition_elem.minutes = definition.minutes if definition.minutes else ''
             definition_elem.seconds = definition.seconds if definition.seconds else ''
             definition_elem.repeats = definition.repeats if definition.repeats else ''
             definition_elem.cron_definition = (definition.cron_definition.decode('utf-8') if 
                 definition.cron_definition else '')
             
             definition_list.append(definition_elem)
 
         return ZATO_OK, etree.tostring(definition_list)
コード例 #2
0
ファイル: http_soap.py プロジェクト: brtsz/zato
    def handle(self, *args, **kwargs):

        params = _get_params(kwargs.get('payload'), ['cluster_id', 'connection', 'transport'], 'data.')

        with closing(self.server.odb.session()) as session:
            item_list = Element('item_list')
            db_items = http_soap_list(session, params['cluster_id'], params['connection'], params['transport'])
            
            for db_item in db_items:

                item = Element('item')
                item.id = db_item.id
                item.name = db_item.name
                item.is_active = db_item.is_active
                item.is_internal = db_item.is_internal
                item.url_path = db_item.url_path
                item.method = db_item.method
                item.soap_action = db_item.soap_action
                item.soap_version = db_item.soap_version
                item.service_id = db_item.service_id
                item.service_name = db_item.service_name
                item.security_id = db_item.security_id
                item.security_name = db_item.security_name
                item.security_def_type = db_item.security_def_type

                item_list.append(item)

            return ZATO_OK, etree.tostring(item_list)