当前位置: 首页>>代码示例>>Python>>正文


Python Element.data方法代码示例

本文整理汇总了Python中lxml.objectify.Element.data方法的典型用法代码示例。如果您正苦于以下问题:Python Element.data方法的具体用法?Python Element.data怎么用?Python Element.data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lxml.objectify.Element的用法示例。


在下文中一共展示了Element.data方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: edit

# 需要导入模块: from lxml.objectify import Element [as 别名]
# 或者: from lxml.objectify.Element import data [as 别名]
def edit(req):
    
    prefix = 'edit-'

    cluster_id = req.POST['cluster_id']
    tech_account_id = req.POST['id']
    name = req.POST[prefix + 'name']
    is_active = req.POST.get(prefix + 'is_active')
    is_active = True if is_active else False
    
    cluster = req.odb.query(Cluster).filter_by(id=cluster_id).first()

    try:
        zato_message = Element('{%s}zato_message' % zato_namespace)
        zato_message.data = Element('data')
        zato_message.data.cluster_id = cluster_id
        zato_message.data.tech_account_id = tech_account_id
        zato_message.data.name = name
        zato_message.data.is_active = is_active
        
        _, zato_message, soap_response = invoke_admin_service(cluster,
                        'zato:security.tech-account.edit', zato_message)
    
    except Exception, e:
        msg = "Could not update the technical account, e=[{e}]".format(e=format_exc(e))
        logger.error(msg)
        return HttpResponseServerError(msg)
开发者ID:brtsz,项目名称:zato,代码行数:29,代码来源:tech_account.py

示例2: index

# 需要导入模块: from lxml.objectify import Element [as 别名]
# 或者: from lxml.objectify.Element import data [as 别名]
def index(req):
    zato_clusters = req.odb.query(Cluster).order_by('name').all()
    choose_cluster_form = ChooseClusterForm(zato_clusters, req.GET)
    cluster_id = req.GET.get('cluster')
    items = []
    
    create_form = CreateForm()
    edit_form = EditForm(prefix='edit')

    if cluster_id and req.method == 'GET':
        
        cluster = req.odb.query(Cluster).filter_by(id=cluster_id).first()
        
        def_ids = _get_def_ids(cluster)
        create_form.set_def_id(def_ids)
        edit_form.set_def_id(def_ids)

        zato_message = Element('{%s}zato_message' % zato_namespace)
        zato_message.data = Element('data')
        zato_message.data.cluster_id = cluster_id
        
        _, zato_message, soap_response  = invoke_admin_service(cluster, 'zato:outgoing.amqp.get-list', zato_message)
        
        if zato_path('data.item_list.item').get_from(zato_message) is not None:
            
            for msg_item in zato_message.data.item_list.item:
                
                id = msg_item.id.text
                name = msg_item.name.text
                is_active = is_boolean(msg_item.is_active.text)
                delivery_mode = int(msg_item.delivery_mode.text)
                priority = msg_item.priority.text
                content_type = msg_item.content_type.text
                content_encoding = msg_item.content_encoding.text
                expiration = msg_item.expiration.text
                user_id = msg_item.user_id.text
                app_id = msg_item.app_id.text
                delivery_mode_text = delivery_friendly_name[delivery_mode]
                def_name = msg_item.def_name.text
                def_id = msg_item.def_id.text
                
                item =  OutgoingAMQP(id, name, is_active, delivery_mode, priority,
                    content_type, content_encoding, expiration, user_id, app_id,
                    def_id, delivery_mode_text, def_name)
                items.append(item)

    return_data = {'zato_clusters':zato_clusters,
        'cluster_id':cluster_id,
        'choose_cluster_form':choose_cluster_form,
        'items':items,
        'create_form':create_form,
        'edit_form':edit_form,
        }
    
    # TODO: Should really be done by a decorator.
    if logger.isEnabledFor(TRACE1):
        logger.log(TRACE1, 'Returning render_to_response [{0}]'.format(return_data))

    return render_to_response('zato/outgoing/amqp.html', return_data,
                              context_instance=RequestContext(req))
开发者ID:brtsz,项目名称:zato,代码行数:62,代码来源:amqp.py

示例3: _get_security_list

# 需要导入模块: from lxml.objectify import Element [as 别名]
# 或者: from lxml.objectify.Element import data [as 别名]
def _get_security_list(cluster):
    zato_message = Element('{%s}zato_message' % zato_namespace)
    zato_message.data = Element('data')
    zato_message.data.cluster_id = cluster.id
    
    _, zato_message, _  = invoke_admin_service(cluster, 'zato:security.get-list', zato_message)
    return zato_message
开发者ID:brtsz,项目名称:zato,代码行数:9,代码来源:http_soap.py

示例4: index

# 需要导入模块: from lxml.objectify import Element [as 别名]
# 或者: from lxml.objectify.Element import data [as 别名]
def index(req):
    zato_clusters = req.odb.query(Cluster).order_by('name').all()
    choose_cluster_form = ChooseClusterForm(zato_clusters, req.GET)
    cluster_id = req.GET.get('cluster')
    items = []
    
    create_form = CreateForm()
    edit_form = EditForm(prefix='edit')

    if cluster_id and req.method == 'GET':
        
        cluster = req.odb.query(Cluster).filter_by(id=cluster_id).first()
        
        zato_message = Element('{%s}zato_message' % zato_namespace)
        zato_message.data = Element('data')
        zato_message.data.cluster_id = cluster_id
        
        _, zato_message, soap_response  = invoke_admin_service(cluster,
                'zato:definition.jms_wmq.get-list', zato_message)
        
        if zato_path('data.definition_list.definition').get_from(zato_message) is not None:
            
            for definition_elem in zato_message.data.definition_list.definition:

                id = definition_elem.id.text
                name = definition_elem.name.text
                host = definition_elem.host.text
                port = definition_elem.port.text
                queue_manager = definition_elem.queue_manager.text
                channel = definition_elem.channel.text
                cache_open_send_queues = is_boolean(definition_elem.cache_open_send_queues.text)
                cache_open_receive_queues = is_boolean(definition_elem.cache_open_receive_queues.text)
                use_shared_connections = is_boolean(definition_elem.use_shared_connections.text)
                ssl = is_boolean(definition_elem.ssl.text)
                ssl_cipher_spec = definition_elem.ssl_cipher_spec.text
                ssl_key_repository = definition_elem.ssl_key_repository.text
                needs_mcd = is_boolean(definition_elem.needs_mcd.text)
                max_chars_printed = definition_elem.max_chars_printed.text
                
                def_jms_wmq = ConnDefWMQ(id, name, host, port, queue_manager, channel,
                    cache_open_send_queues, cache_open_receive_queues, use_shared_connections, 
                    ssl, ssl_cipher_spec, ssl_key_repository, needs_mcd, max_chars_printed)
                
                items.append(def_jms_wmq)
                

    return_data = {'zato_clusters':zato_clusters,
        'cluster_id':cluster_id,
        'choose_cluster_form':choose_cluster_form,
        'items':items,
        'create_form':create_form,
        'edit_form':edit_form,
        }
    
    # TODO: Should really be done by a decorator.
    if logger.isEnabledFor(TRACE1):
        logger.log(TRACE1, 'Returning render_to_response [{0}]'.format(return_data))

    return render_to_response('zato/definition/jms_wmq.html', return_data,
                              context_instance=RequestContext(req))
开发者ID:brtsz,项目名称:zato,代码行数:62,代码来源:jms_wmq.py

示例5: _get_edit_create_message

# 需要导入模块: from lxml.objectify import Element [as 别名]
# 或者: from lxml.objectify.Element import data [as 别名]
def _get_edit_create_message(params, prefix=''):
    """ Creates a base document which can be used by both 'edit' and 'create' actions
    for channels and outgoing connections.
    """
    zato_message = Element('{%s}zato_message' % zato_namespace)
    zato_message.data = Element('data')
    zato_message.data.is_internal = False
    zato_message.data.connection = params['connection']
    zato_message.data.transport = params['transport']
    zato_message.data.id = params.get('id')
    zato_message.data.cluster_id = params['cluster_id']
    zato_message.data.name = params[prefix + 'name']
    zato_message.data.is_active = bool(params.get(prefix + 'is_active'))
    zato_message.data.url_path = params[prefix + 'url_path']
    zato_message.data.method = params[prefix + 'method']
    zato_message.data.soap_action = params.get(prefix + 'soap_action', '')
    zato_message.data.soap_version = params.get(prefix + 'soap_version', '')
    zato_message.data.service = params[prefix + 'service']

    security = params[prefix + 'security']
    if security != ZATO_NONE:
        _, sec_def_id = security.split('/')
    else:
        _, sec_def_id = ZATO_NONE, ZATO_NONE
        
    zato_message.data.sec_def_id = sec_def_id

    return zato_message
开发者ID:brtsz,项目名称:zato,代码行数:30,代码来源:http_soap.py

示例6: index

# 需要导入模块: from lxml.objectify import Element [as 别名]
# 或者: from lxml.objectify.Element import data [as 别名]
def index(req):

    zato_clusters = req.odb.query(Cluster).order_by('name').all()
    choose_cluster_form = ChooseClusterForm(zato_clusters, req.GET)
    cluster_id = req.GET.get('cluster')
    items = []
    
    create_form = CreateForm()
    edit_form = EditForm(prefix='edit')
    change_password_form = ChangePasswordForm()

    if cluster_id and req.method == 'GET':
        cluster = req.odb.query(Cluster).filter_by(id=cluster_id).first()

        zato_message = Element('{%s}zato_message' % zato_namespace)
        zato_message.data = Element('data')
        zato_message.data.cluster_id = cluster_id

        _ignored, zato_message, soap_response  = invoke_admin_service(cluster,
                'zato:security.wss.get-list', zato_message)

        if zato_path('data.definition_list.definition').get_from(zato_message) is not None:
            for definition_elem in zato_message.data.definition_list.definition:

                id = definition_elem.id.text
                name = definition_elem.name.text
                is_active = is_boolean(definition_elem.is_active.text)
                username = definition_elem.username.text
                password_type = ZATO_WSS_PASSWORD_TYPES[definition_elem.password_type.text]
                password_type_raw = definition_elem.password_type.text
                reject_empty_nonce_ts = definition_elem.reject_empty_nonce_ts
                reject_stale_username = definition_elem.reject_stale_username
                expiry_limit = definition_elem.expiry_limit
                nonce_freshness = definition_elem.nonce_freshness

                wss = WSSDefinition(id, name, is_active, username, None,
                        password_type, reject_empty_nonce_ts, reject_stale_username,
                        expiry_limit, nonce_freshness, password_type_raw=password_type_raw)

                items.append(wss)

    return_data = {'zato_clusters':zato_clusters,
        'cluster_id':cluster_id,
        'choose_cluster_form':choose_cluster_form,
        'items':items,
        'create_form': create_form,
        'edit_form': edit_form,
        'change_password_form': change_password_form
        }

    # TODO: Should really be done by a decorator.
    if logger.isEnabledFor(TRACE1):
        logger.log(TRACE1, 'Returning render_to_response [%s]' % return_data)

    return render_to_response('zato/security/wss.html', return_data,
                              context_instance=RequestContext(req))
开发者ID:brtsz,项目名称:zato,代码行数:58,代码来源:wss.py

示例7: _get_edit_create_message

# 需要导入模块: from lxml.objectify import Element [as 别名]
# 或者: from lxml.objectify.Element import data [as 别名]
def _get_edit_create_message(params, prefix=''):
    """ Creates a base document which can be used by both 'edit' and 'create' actions.
    """
    zato_message = Element('{%s}zato_message' % zato_namespace)
    zato_message.data = Element('data')
    zato_message.data.id = params.get('id')
    zato_message.data.cluster_id = params['cluster_id']
    zato_message.data.name = params[prefix + 'name']
    zato_message.data.is_active = bool(params.get(prefix + 'is_active'))
    
    return zato_message
开发者ID:brtsz,项目名称:zato,代码行数:13,代码来源:service.py

示例8: index

# 需要导入模块: from lxml.objectify import Element [as 别名]
# 或者: from lxml.objectify.Element import data [as 别名]
def index(req):
    zato_clusters = req.odb.query(Cluster).order_by("name").all()
    choose_cluster_form = ChooseClusterForm(zato_clusters, req.GET)
    cluster_id = req.GET.get("cluster")
    items = []

    create_form = CreateForm()
    edit_form = EditForm(prefix="edit")
    change_password_form = ChangePasswordForm()

    if cluster_id and req.method == "GET":

        cluster = req.odb.query(Cluster).filter_by(id=cluster_id).first()
        zato_message = Element("{%s}zato_message" % zato_namespace)
        zato_message.data = Element("data")
        zato_message.data.cluster_id = cluster_id

        _, zato_message, soap_response = invoke_admin_service(cluster, "zato:outgoing.ftp.get-list", zato_message)

        if zato_path("data.item_list.item").get_from(zato_message) is not None:

            for msg_item in zato_message.data.item_list.item:

                id = msg_item.id.text
                name = msg_item.name.text
                is_active = is_boolean(msg_item.is_active.text)

                host = msg_item.host.text if msg_item.host else ""
                user = msg_item.user.text if msg_item.user else ""
                acct = msg_item.acct.text if msg_item.acct else ""
                timeout = msg_item.timeout.text if msg_item.timeout else ""
                port = msg_item.port.text if msg_item.port else ""
                dircache = is_boolean(msg_item.dircache.text)

                item = OutgoingFTP(id, name, is_active, host, user, None, acct, timeout, port, dircache)
                items.append(item)

    return_data = {
        "zato_clusters": zato_clusters,
        "cluster_id": cluster_id,
        "choose_cluster_form": choose_cluster_form,
        "items": items,
        "create_form": create_form,
        "edit_form": edit_form,
        "change_password_form": change_password_form,
    }

    # TODO: Should really be done by a decorator.
    if logger.isEnabledFor(TRACE1):
        logger.log(TRACE1, "Returning render_to_response [{0}]".format(return_data))

    return render_to_response("zato/outgoing/ftp.html", return_data, context_instance=RequestContext(req))
开发者ID:brtsz,项目名称:zato,代码行数:54,代码来源:ftp.py

示例9: _edit_create_response

# 需要导入模块: from lxml.objectify import Element [as 别名]
# 或者: from lxml.objectify.Element import data [as 别名]
def _edit_create_response(cluster, verb, id, name, def_id):

    zato_message = Element("{%s}zato_message" % zato_namespace)
    zato_message.data = Element("data")
    zato_message.data.id = def_id

    _, zato_message, soap_response = invoke_admin_service(cluster, "zato:definition.amqp.get-by-id", zato_message)

    return_data = {
        "id": id,
        "message": "Successfully {0} the AMQP channel [{1}]".format(verb, name),
        "def_name": zato_message.data.definition.name.text,
    }

    return HttpResponse(dumps(return_data), mimetype="application/javascript")
开发者ID:brtsz,项目名称:zato,代码行数:17,代码来源:amqp.py

示例10: _get_edit_create_message

# 需要导入模块: from lxml.objectify import Element [as 别名]
# 或者: from lxml.objectify.Element import data [as 别名]
def _get_edit_create_message(params, prefix=""):
    """ Creates a base document which can be used by both 'edit' and 'create' actions.
    """
    zato_message = Element("{%s}zato_message" % zato_namespace)
    zato_message.data = Element("data")
    zato_message.data.id = params.get("id")
    zato_message.data.cluster_id = params["cluster_id"]
    zato_message.data.name = params[prefix + "name"]
    zato_message.data.is_active = bool(params.get(prefix + "is_active"))
    zato_message.data.def_id = params[prefix + "def_id"]
    zato_message.data.queue = params[prefix + "queue"]
    zato_message.data.consumer_tag_prefix = params[prefix + "consumer_tag_prefix"]
    zato_message.data.service = params[prefix + "service"]

    return zato_message
开发者ID:brtsz,项目名称:zato,代码行数:17,代码来源:amqp.py

示例11: _edit_create_response

# 需要导入模块: from lxml.objectify import Element [as 别名]
# 或者: from lxml.objectify.Element import data [as 别名]
def _edit_create_response(cluster, verb, id, name, cluster_id, def_id):

    zato_message = Element('{%s}zato_message' % zato_namespace)
    zato_message.data = Element('data')
    zato_message.data.id = def_id
    zato_message.data.cluster_id = cluster_id
    
    _, zato_message, soap_response  = invoke_admin_service(cluster, 'zato:definition.jms_wmq.get-by-id', zato_message)    
    
    return_data = {'id': id,
                   'message': 'Successfully {0} the JMS WebSphere MQ channel [{1}]'.format(verb, name),
                   'def_name': zato_message.data.definition.name.text
                }
    
    return HttpResponse(dumps(return_data), mimetype='application/javascript')
开发者ID:brtsz,项目名称:zato,代码行数:17,代码来源:jms_wmq.py

示例12: _get_def_ids

# 需要导入模块: from lxml.objectify import Element [as 别名]
# 或者: from lxml.objectify.Element import data [as 别名]
def _get_def_ids(cluster):
    out = {}
    
    zato_message = Element('{%s}zato_message' % zato_namespace)
    zato_message.data = Element('data')
    zato_message.data.cluster_id = cluster.id        
    _, zato_message, soap_response  = invoke_admin_service(cluster, 'zato:definition.amqp.get-list', zato_message)
    
    if zato_path('data.definition_list.definition').get_from(zato_message) is not None:
        for definition_elem in zato_message.data.definition_list.definition:
            id = definition_elem.id.text
            name = definition_elem.name.text
            out[id] = name
        
    return out
开发者ID:brtsz,项目名称:zato,代码行数:17,代码来源:amqp.py

示例13: _get_create_edit_message

# 需要导入模块: from lxml.objectify import Element [as 别名]
# 或者: from lxml.objectify.Element import data [as 别名]
def _get_create_edit_message(cluster, params, form_prefix=""):
    """ Creates a base document which can be used by both 'edit' and 'create'
    actions, regardless of the job's type.
    """
    zato_message = Element('{%s}zato_message' % zato_namespace)
    zato_message.data = Element('data')
    zato_message.data.name = params[form_prefix + 'name']
    zato_message.data.cluster_id = cluster.id
    zato_message.data.id = params.get(form_prefix + 'id', '')
    zato_message.data.is_active = bool(params.get(form_prefix + 'is_active'))
    zato_message.data.service = params.get(form_prefix + 'service', '')
    zato_message.data.extra = params.get(form_prefix + 'extra', '')
    zato_message.data.start_date = params.get(form_prefix + 'start_date', '')
    
    return zato_message
开发者ID:brtsz,项目名称:zato,代码行数:17,代码来源:scheduler.py

示例14: index

# 需要导入模块: from lxml.objectify import Element [as 别名]
# 或者: from lxml.objectify.Element import data [as 别名]
def index(req):
    zato_clusters = req.odb.query(Cluster).order_by('name').all()
    choose_cluster_form = ChooseClusterForm(zato_clusters, req.GET)
    cluster_id = req.GET.get('cluster')
    items = []
    
    create_form = CreateForm()
    edit_form = EditForm(prefix='edit')
    change_password_form = ChangePasswordForm()

    if cluster_id and req.method == 'GET':
        
        cluster = req.odb.query(Cluster).filter_by(id=cluster_id).first()
        
        zato_message = Element('{%s}zato_message' % zato_namespace)
        zato_message.data = Element('data')
        zato_message.data.cluster_id = cluster_id
        
        _, zato_message, soap_response  = invoke_admin_service(cluster,
                'zato:security.tech-account.get-list', zato_message)
        
        if zato_path('data.definition_list.definition').get_from(zato_message) is not None:
            
            for definition_elem in zato_message.data.definition_list.definition:
                
                id = definition_elem.id.text
                name = definition_elem.name.text
                is_active = is_boolean(definition_elem.is_active.text)
                
                account = TechnicalAccount(id, name, is_active=is_active)
                items.append(account)
                

    return_data = {'zato_clusters':zato_clusters,
        'cluster_id':cluster_id,
        'choose_cluster_form':choose_cluster_form,
        'items':items,
        'create_form':create_form,
        'edit_form':edit_form,
        'change_password_form':change_password_form
        }
    
    # TODO: Should really be done by a decorator.
    if logger.isEnabledFor(TRACE1):
        logger.log(TRACE1, 'Returning render_to_response [{0}]'.format(return_data))

    return render_to_response('zato/security/tech-account.html', return_data,
                              context_instance=RequestContext(req))
开发者ID:brtsz,项目名称:zato,代码行数:50,代码来源:tech_account.py

示例15: delete

# 需要导入模块: from lxml.objectify import Element [as 别名]
# 或者: from lxml.objectify.Element import data [as 别名]
def delete(req, id, cluster_id):
    
    cluster = req.odb.query(Cluster).filter_by(id=cluster_id).first()
    
    try:
        zato_message = Element('{%s}zato_message' % zato_namespace)
        zato_message.data = Element('data')
        zato_message.data.id = id
        
        _, zato_message, soap_response = invoke_admin_service(cluster,
                        'zato:security.basic-auth.delete', zato_message)
    
    except Exception, e:
        msg = "Could not delete the HTTP Basic Auth definition, e=[{e}]".format(e=format_exc(e))
        logger.error(msg)
        return HttpResponseServerError(msg)
开发者ID:brtsz,项目名称:zato,代码行数:18,代码来源:basic_auth.py


注:本文中的lxml.objectify.Element.data方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。