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


Python utils._getNodeAttribute函数代码示例

本文整理汇总了Python中utils._getNodeAttribute函数的典型用法代码示例。如果您正苦于以下问题:Python _getNodeAttribute函数的具体用法?Python _getNodeAttribute怎么用?Python _getNodeAttribute使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: _extractScriptNodes

def _extractScriptNodes( root, encoding=None ):

    result = []

    for s_node in root.getElementsByTagName( 'script' ):

        try:
            function = _getNodeAttribute( s_node, 'function' )
        except ValueError:
            function = ''

        try:
            module = _getNodeAttribute( s_node, 'module' )
        except ValueError:
            module = ''

        info = { 'script_id' : _getNodeAttribute( s_node, 'script_id' )
               , 'meta_type' : _getNodeAttribute( s_node, 'type' , encoding )
               , 'function'  : function
               , 'module'    : module
               }

        filename = _queryNodeAttribute( s_node, 'filename' , None, encoding )

        if filename is not None:
            info[ 'filename' ] = filename

        result.append( info )

    return result
开发者ID:goschtl,项目名称:zope,代码行数:30,代码来源:workflow.py

示例2: parseWorkflowXML

    def parseWorkflowXML( self, xml, encoding=None ):

        """ Pseudo API.
        """
        dom = domParseString( xml )

        root = dom.getElementsByTagName( 'dc-workflow' )[ 0 ]

        workflow_id = _getNodeAttribute( root, 'workflow_id', encoding )
        title = _getNodeAttribute( root, 'title', encoding )
        state_variable = _getNodeAttribute( root, 'state_variable', encoding )
        initial_state = _getNodeAttribute( root, 'initial_state', encoding )

        states = _extractStateNodes( root, encoding )
        transitions = _extractTransitionNodes( root, encoding )
        variables = _extractVariableNodes( root, encoding )
        worklists = _extractWorklistNodes( root, encoding )
        permissions = _extractPermissionNodes( root, encoding )
        scripts = _extractScriptNodes( root, encoding )

        return ( workflow_id
               , title
               , state_variable
               , initial_state
               , states
               , transitions
               , variables
               , worklists
               , permissions
               , scripts
               )
开发者ID:goschtl,项目名称:zope,代码行数:31,代码来源:workflow.py

示例3: _extractMatchNode

def _extractMatchNode( parent, encoding=None ):

    nodes = parent.getElementsByTagName( 'match' )

    result = {}

    for node in nodes:

        name = _getNodeAttribute( node, 'name', encoding )
        values = _getNodeAttribute( node, 'values', encoding )
        result[ name ] = _SEMICOLON_LIST_SPLITTER.split( values )

    return result
开发者ID:goschtl,项目名称:zope,代码行数:13,代码来源:workflow.py

示例4: _extractAliasesNode

def _extractAliasesNode(parent, encoding=None):

    result = {}

    aliases = parent.getElementsByTagName('aliases')[0]
    for alias in aliases.getElementsByTagName('alias'):

        alias_from = _getNodeAttribute(alias, 'from', encoding)
        alias_to = _getNodeAttribute(alias, 'to', encoding)

        result[alias_from] = alias_to

    return result
开发者ID:goschtl,项目名称:zope,代码行数:13,代码来源:typeinfo.py

示例5: _extractActionNode

def _extractActionNode( parent, encoding=None ):

    nodes = parent.getElementsByTagName( 'action' )
    assert len( nodes ) <= 1, nodes

    if len( nodes ) < 1:
        return { 'name' : '', 'url' : '', 'category' : '' }

    node = nodes[ 0 ]

    return { 'name' : _coalesceTextNodeChildren( node, encoding )
           , 'url' : _getNodeAttribute( node, 'url', encoding )
           , 'category' : _getNodeAttribute( node, 'category', encoding )
           }
开发者ID:goschtl,项目名称:zope,代码行数:14,代码来源:workflow.py

示例6: _extractVariableNodes

def _extractVariableNodes( root, encoding=None ):

    result = []

    for v_node in root.getElementsByTagName( 'variable' ):

        info = { 'variable_id' : _getNodeAttribute( v_node, 'variable_id'
                                                    , encoding )
               , 'description' : _extractDescriptionNode( v_node, encoding )
               , 'for_catalog' : _getNodeAttributeBoolean( v_node
                                                         , 'for_catalog'
                                                         )
               , 'for_status' : _getNodeAttributeBoolean( v_node
                                                        , 'for_status'
                                                        )
               , 'update_always' : _getNodeAttributeBoolean( v_node
                                                           , 'update_always'
                                                           )
               , 'default' : _extractDefaultNode( v_node, encoding )
               , 'guard' : _extractGuardNode( v_node, encoding )
               }

        result.append( info )

    return result
开发者ID:goschtl,项目名称:zope,代码行数:25,代码来源:workflow.py

示例7: _extractTransitionNodes

def _extractTransitionNodes( root, encoding=None ):

    result = []

    for t_node in root.getElementsByTagName( 'transition' ):

        info = { 'transition_id' : _getNodeAttribute( t_node, 'transition_id'
                                                    , encoding )
               , 'title' : _getNodeAttribute( t_node, 'title', encoding )
               , 'description' : _extractDescriptionNode( t_node, encoding )
               , 'new_state' : _getNodeAttribute( t_node, 'new_state'
                                                , encoding )
               , 'trigger' : _getNodeAttribute( t_node, 'trigger', encoding )
               , 'before_script' : _getNodeAttribute( t_node, 'before_script'
                                                  , encoding )
               , 'after_script' : _getNodeAttribute( t_node, 'after_script'
                                                   , encoding )
               , 'action' : _extractActionNode( t_node, encoding )
               , 'guard' : _extractGuardNode( t_node, encoding )
               }

        info[ 'variables' ] = var_map = {}

        for assignment in t_node.getElementsByTagName( 'assignment' ):

            name = _getNodeAttribute( assignment, 'name', encoding )
            expr = _coalesceTextNodeChildren( assignment, encoding )
            var_map[ name ] = expr

        result.append( info )

    return result
开发者ID:goschtl,项目名称:zope,代码行数:32,代码来源:workflow.py

示例8: _extractStateNodes

def _extractStateNodes( root, encoding=None ):

    result = []

    for s_node in root.getElementsByTagName( 'state' ):

        info = { 'state_id' : _getNodeAttribute( s_node, 'state_id', encoding )
               , 'title' : _getNodeAttribute( s_node, 'title', encoding )
               , 'description' : _extractDescriptionNode( s_node, encoding )
               }

        info[ 'transitions' ] = [ _getNodeAttribute( x, 'transition_id'
                                                   , encoding )
                                  for x in s_node.getElementsByTagName(
                                                        'exit-transition' ) ]

        info[ 'permissions' ] = permission_map = {}

        for p_map in s_node.getElementsByTagName( 'permission-map' ):

            name = _getNodeAttribute( p_map, 'name', encoding )
            acquired = _getNodeAttributeBoolean( p_map, 'acquired' )

            roles = [ _coalesceTextNodeChildren( x, encoding )
                        for x in p_map.getElementsByTagName(
                                            'permission-role' ) ]

            if not acquired:
                roles = tuple( roles )

            permission_map[ name ] = roles

        info[ 'groups' ] = group_map = []

        for g_map in s_node.getElementsByTagName( 'group-map' ):

            name = _getNodeAttribute( g_map, 'name', encoding )

            roles = [ _coalesceTextNodeChildren( x, encoding )
                        for x in g_map.getElementsByTagName(
                                            'group-role' ) ]

            group_map.append( ( name, tuple( roles ) ) )

        info[ 'variables' ] = var_map = {}

        for assignment in s_node.getElementsByTagName( 'assignment' ):

            name = _getNodeAttribute( assignment, 'name', encoding )
            type_id = _getNodeAttribute( assignment, 'type', encoding )
            value = _coalesceTextNodeChildren( assignment, encoding )

            var_map[ name ] = { 'name'  : name
                              , 'type'  : type_id
                              , 'value' : value
                              }

        result.append( info )

    return result
开发者ID:goschtl,项目名称:zope,代码行数:60,代码来源:workflow.py

示例9: _extractWorklistNodes

def _extractWorklistNodes( root, encoding=None ):

    result = []

    for w_node in root.getElementsByTagName( 'worklist' ):

        info = { 'worklist_id' : _getNodeAttribute( w_node, 'worklist_id'
                                                    , encoding )
               , 'title' : _getNodeAttribute( w_node, 'title' , encoding )
               , 'description' : _extractDescriptionNode( w_node, encoding )
               , 'match' : _extractMatchNode( w_node, encoding )
               , 'action' : _extractActionNode( w_node, encoding )
               , 'guard' : _extractGuardNode( w_node, encoding )
               }

        result.append( info )

    return result
开发者ID:goschtl,项目名称:zope,代码行数:18,代码来源:workflow.py

示例10: _extractRoleNodes

def _extractRoleNodes(parent, encoding=None):

    result = []

    for r_node in parent.getElementsByTagName('role'):
        value = _getNodeAttribute(r_node, 'name', encoding)
        result.append(value)

    return tuple(result)
开发者ID:goschtl,项目名称:zope,代码行数:9,代码来源:rolemap.py

示例11: _extractScriptNodes

def _extractScriptNodes( root, encoding=None ):

    result = []

    for s_node in root.getElementsByTagName( 'script' ):


        info = { 'script_id' : _getNodeAttribute( s_node, 'script_id' )
               , 'meta_type' : _getNodeAttribute( s_node, 'type' , encoding )
               }

        filename = _queryNodeAttribute( s_node, 'filename' , None, encoding )

        if filename is not None:
            info[ 'filename' ] = filename

        result.append( info )

    return result
开发者ID:goschtl,项目名称:zope,代码行数:19,代码来源:workflow.py

示例12: _extractActionProviderNodes

def _extractActionProviderNodes(parent, encoding=None):

    result = []

    for ap_node in parent.getElementsByTagName('action-provider'):

        id = _getNodeAttribute(ap_node, 'id', encoding)
        actions = _extractActionNodes(ap_node, encoding)

        result.append( { 'id': id, 'actions': actions } )

    return result
开发者ID:goschtl,项目名称:zope,代码行数:12,代码来源:actions.py

示例13: _extractPermissionNodes

def _extractPermissionNodes(parent, encoding=None):

    result = []

    for p_node in parent.getElementsByTagName('permission'):
        name    = _getNodeAttribute(p_node, 'name', encoding)
        roles   = _extractRoleNodes(p_node, encoding)
        acquire = _getNodeAttributeBoolean(p_node, 'acquire')
        result.append( { 'name': name,
                         'roles': roles,
                         'acquire': acquire } )

    return tuple(result)
开发者ID:goschtl,项目名称:zope,代码行数:13,代码来源:rolemap.py

示例14: _es

 def _es(key):
     return _getNodeAttribute(a_node, key, encoding)
开发者ID:goschtl,项目名称:zope,代码行数:2,代码来源:actions.py


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