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


Python Tree.get_flat_tree方法代码示例

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


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

示例1: check_perms

# 需要导入模块: import Tree [as 别名]
# 或者: from Tree import get_flat_tree [as 别名]
def check_perms(s, set, handle, treename, **kwargs):
    ask_flag = kwargs.get('Ask', True)
    if not ask_flag:
        if not MyUtil.get_yn('!!! Warning !!! ask = False: Will not ask to make changes, okay? Enter N to Exit, Y to Continue:'):
            print('exiting...')
            sys.exit(0)
    tr = Tree.return_tree(s, handle, treename)
    handles = Tree.get_flat_tree(tr)
    for handle in handles:
        fix_set(s, handle, set, **kwargs)
开发者ID:pbbarnes,项目名称:Library1,代码行数:12,代码来源:PERM.py

示例2: checkPerms

# 需要导入模块: import Tree [as 别名]
# 或者: from Tree import get_flat_tree [as 别名]
def checkPerms(target, permissions):
    # Login to DCC
    s = DCC.login(CF.dcc_url + CF.dcc_login)

    if 'Collection' in target:
        tr = Tree.get_tree(s,target)
        Tree.print_tree(s, tr)
        docList = Tree.get_flat_tree(tr)
        
    else:
        docList = [target]
    
    printCheckCriteria(target, permissions)
    passList = []
    failList = []

    for doc in docList:
        checkFlag = True
        if 'Document' in doc:
            fd = DCC.prop_get(s, doc, InfoSet = 'DocBasic')
            fd['permissions'] = DCC.prop_get(s, doc, InfoSet = 'Perms', Depth = '0')
    
            print("\n\n*** Document Entry", fd['handle'], "***")
            print("DCC Name: \"",fd['title'],"\"",sep="")
            print("TMT Document Number: ", fd['tmtnum'])
            print("https://docushare.tmt.org/docushare/dsweb/ServicesLib/" + fd['handle'] + "/view")
        elif 'Collection' in doc:
            fd = DCC.prop_get(s, doc, InfoSet = 'CollData')
            fd['permissions'] = DCC.prop_get(s, doc, InfoSet = 'Perms', Depth = '0')
            print("\n\n*** Collection Entry", fd['handle'], "***")
            print("https://docushare.tmt.org/docushare/dsweb/ServicesLib/" + fd['handle'] + "/view")
        else:
            checkFlag = False
            print("\nNot checking permissions on object that is not a Collection or Document):",doc) 

        if checkFlag:
            OkayPerms = []
            for perm in sorted(fd["permissions"]["perms"], key = lambda x: x["handle"]):
                # Go through each set and create a dictionary of entries that have perms okay
                for sets in permissions:
                    for item,plist in sets.items():
                        if perm["handle"] == item:
                            if printCheckPerms(perm,plist) == True:
                                OkayPerms.append(item)
            permFlag = False
            for sets in permissions:
                testFlag = True
                for item in sets:
                    if not item in OkayPerms:
                        testFlag = False
                if testFlag == True:
                    permFlag = True
                        
            if permFlag == True:
                print("*** PERMISSIONS MEET CRITERIA ***")
                passList.append(doc)
            else:
                print("!!! PERMISSIONS DO NOT MEET CRITERIA !!!")
            failList.append(doc)
            
    return([passList,failList])
开发者ID:pbbarnes,项目名称:Library1,代码行数:63,代码来源:PERM.py

示例3: main

# 需要导入模块: import Tree [as 别名]
# 或者: from Tree import get_flat_tree [as 别名]
def main():
    # Login to DCC
    s = DCC.login(CF.dcc_url + CF.dcc_login) 
    
    #****** SET Flag for asking about changes ******
    ask_flag = MyUtil.get_yn('Ask about changes to files ***  BE CAREFUL !!! *** (Y/N)? ')
    print()
        
    #****** Choose SET ******
    
    ### Safe to run without checking ###
#     set = PD.SET_REMOVE_RO_IF_SE_READERSHIP 
#     set =  PD.SET_REMOVE_STR_MANAGERS 
#     set = PD.SET_REMOVE_INACTIVE
    set = PD.SET_PUBLISHED
  
    ### Don't Run without checking ###
#     set = PD.SET_PERM_NRTCPDR
#     set = PD.SET_M1CS_PDR
#     set = PD.SET_REMOVE_STR_MANAGERS
#     set = PD.SET_SE_READERSHIP    
#     set = PD.SET_IRIS_REMOVE_MATTHIAS_MANAGE_FALSE
#     set = PD.SET_IRIS_REMOVE_ISBRUCKER
#     set = PD.SET_REPLACE_IRIS_EAR_WITH_ALL
#     set = PD.SET_REMOVE_STR_MANAGERS
#     set = PD.SET_REMOVE_UNNEEDED

### IRIS Manager Set with removal of group membership
#     set = PD.SET_IRIS_TEAM
#     ghs = PERM.get_group_handles(s,PD.grp_IRIS_MANAGE)
#     for gh in ghs:
#         PD.SET_ADD_IRIS_MANAGER['PermAct'].append(PD.remove_user(gh))
#     print(PD.SET_ADD_IRIS_MANAGER['PermAct'])

### IRIS Team Set with removal of group members
#     set = PD.SET_IRIS_TEAM   
#     ghs = PERM.get_group_handles(s,PD.grp_IRIS_team)
#     for gh in ghs:
#         PD.SET_IRIS_TEAM['PermAct'].append(PD.remove_user_ifperms(gh, PD.manage_false)) 
#     print(PD.SET_IRIS_TEAM['PermAct'])


### M1S Team Set with removal of optics group members
#     set = PD.SET_M1S_Suijian
#      
#     PD.remove_user_if_group(s, set, PD.grp_optics, PD.manage_false)
#     PD.remove_user_if_group(s, set, PD.grp_niaotEAR, PD.WM_false)
#  
#     print(PD.SET_M1S_Suijian['PermAct'])        

### CRYO Team Set with removal of optics group members
#     set = PD.SET_EMPTY
#      
#     PD.remove_user_if_group(s, set, PD.grp_CryoTeam, PD.manage_false)
#     PD.remove_user_if_group(s, set, PD.grp_CryoManager,PD.read_true)
#  
#     print(PD.SET_EMPTY['PermAct'])      
        
    #****** Choose Collection ******
#     m1cs_pdr_root = 'Collection-10725'
#     m1cs_pdr_presentation = 'Collection-10821'
#     handle = m1cs_pdr_presentation

#     config_control = 'Collection-8277'
#     handle = config_control

    IRIS_science = 'Collection-7542'
    IRIS = 'Collection-2463'
    Change_control = 'Collection-399'
    SE_access_handling = 'Collection-2949'
    SE_interface_control = 'Collection-195'
    SE_budgets = 'Collection-309'
    Published = 'Collection-8277'
    IRIS_LPDR = 'Collection-11161'
    NRTC_PDR = 'Collection-10045'
    M1S_suijian_coll = 'Collection-5678'
    CRYO_coll = 'Collection-9141'
    LGSF_IOE = 'Collection-4956'
    ENC_Construction_Phase = 'Collection-10598'
    
    Test = 'Document-27819'
    
#     set = PD.SET_ENC_CONSTRUCTION
#     set = PD.SET_REMOVE_RO_IF_SE_READERSHIP
#     handle = ENC_Construction_Phase
#     handle =  Test
    handle = Published
    
    #******!!!  Run !!! ******
#     print(set)
    tr = Tree.return_tree(s, handle, 'Tree_' + handle)
    handles = Tree.get_flat_tree(tr)
    PERM.check_perms(s, set, handles, Ask = ask_flag)
开发者ID:scroberts,项目名称:Permissions,代码行数:95,代码来源:set_permissions.py

示例4: create_DCC_mirror

# 需要导入模块: import Tree [as 别名]
# 或者: from Tree import get_flat_tree [as 别名]
def create_DCC_mirror(s, dcc_handle, dirpath, **kwargs):
    tr = Tree.get_tree(s,dcc_handle)
    Tree.print_tree(s, tr)
    docList = Tree.get_flat_tree(tr)
    traverse(s, tr, tr['root']['collections'][0], dirpath, **kwargs)
开发者ID:pbbarnes,项目名称:Library1,代码行数:7,代码来源:FileSys.py

示例5: print

# 需要导入模块: import Tree [as 别名]
# 或者: from Tree import get_flat_tree [as 别名]
docmodreport.append('dccDocHandleHyperlink')
docmodreport.append('dccDocVersionHyperlink')
docmodreport.append('dccDocSignedApproved')
docmodreport.append('TMTPublished')
docmodreport.append('dccDocStatus')
docmodreport.append('dccStatusCheckDate')
docmodreport.append('dccDocHandleNo')

s = DCC.login(CF.dcc_url + CF.dcc_login)

docmodlist = []

pub_coll = 'Collection-8277'

tr = Tree.return_tree(s, pub_coll, 'Tree_' + pub_coll)
pub_list = Tree.get_flat_tree(tr)

docmatch = {}

for ref in reflist.items():
    print('looking for ', ref[0], ref[1])
    for doc in dm.items():
        if DocMod.is_in_dict(ref[1],doc[1]):
            print('\n\n\n############## Found Document Module Object #:', doc[0], '##############\n')
            DocMod.print_report(docmodreport, doc[1])
            handle = 'Document-' + doc[1]['dccDocHandleNo']
            
            docmatch[handle] = doc[1]
            
            # Construct a new PERM set for each handle entry
            if_not_in_pub_coll = PD.dict_crit_act(
开发者ID:gtrancho,项目名称:Utilities,代码行数:33,代码来源:DocModAudit.py


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