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


Python DCC类代码示例

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


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

示例1: modify_dcc_perms

def modify_dcc_perms(s, handle, permdata, **kwargs):
    ask_flag = kwargs.get('Ask',True)
    print('\n   Modifying Permissions to:',handle)
    DCC.print_perms(permdata)       
    if ask_flag == False or MyUtil.get_yn('Change Permissions (Y/N)?'):
        print('Changing permissions...')
        DCC.set_permissions(s, handle, permdata)
开发者ID:pbbarnes,项目名称:Library1,代码行数:7,代码来源:PERM.py

示例2: fix_set

def fix_set(s, handle, set, **kwargs):
    # kwargs
    #   ask = True | False, Do/Don't ask if changes should be made (!!! Dangerous !!!)
    #   default is ask

    if 'Document-' in handle:
        fd = DCC.prop_get(s, handle, InfoSet = 'DocBasic')
    elif 'Collection-' in handle:
        fd = DCC.prop_get(s, handle, InfoSet = 'CollData')
    else:
        fd = DCC.prop_get(s, handle, InfoSet = 'Title')    
    permdata = DCC.prop_get(s, handle, InfoSet = 'Perms')
    print(fd['handle'], ':', fd['title']) 
    
    fd['permissions'] = permdata
    [removelist, changelist, addlist] = id_perm_changes(s,handle, fd, permdata, set) 
    ch_flag = False
    if len(removelist) or len(changelist) or len(addlist):
        print('\n##############       ENTRY       ##############')
        if 'Document-' in handle:
            DCC.print_doc_basic(fd)
        elif 'Collection-' in handle:
            DCC.print_coll_data(fd)
        else:
            print('Not Document or Collection:', handle, ':', fd['title'])   
        print('https://docushare.tmt.org/docushare/dsweb/ServicesLib/',handle,'/Permissions',sep='')
        DCC.print_perms(permdata)    
        print('\nSuggested Changes...')
        print_perm_changes(removelist, changelist, addlist)
        make_perm_changes(s, handle, permdata, removelist, changelist, addlist, **kwargs)
开发者ID:pbbarnes,项目名称:Library1,代码行数:30,代码来源:PERM.py

示例3: move_object

def move_object(s):
    obj = input("Enter Object Handle: ")
    source = input("Enter Collection Handle to Move From: ")
    dest = input("Enter Collection Handle to Move To: ")

    DCC.dcc_move(s, obj, source, dest)
    return    
开发者ID:,项目名称:,代码行数:7,代码来源:

示例4: make_cid

def make_cid(dirpath, CID_coll, htmlfile, outroot):
    # Get list of DCC documents from a Word file saved as html
    GetUrlWord.get_url_word(dirpath + outroot, dirpath + htmlfile)  

    # Login to DCC
    prod = ['prod', 'production', 'p', ' ']
    tes = ['test', 'tes', 't']
    checker = False
    print("Would you like to log into the production site or the test site?")
    print("Valid Inputs are as follows: Production, prod, p, test, t :", end="")
    choice = input().lower()
    #while loop to continue asking the user for input until a correct input has been entered
    while (checker == False):
        #Production site login choice
        if(choice in prod):
            print("You are now logging into the Production version of DocuShare")
            s = DCC.login(Site ='Production')
            checker = True
        #test site login choice
        elif(choice in tes):
            print("You are now logging into the test VM DocuShare")
            s = DCC.login(Site ='Test')
            checker = True
        #cf.dcc_url + cf.dcc_login
        #error message alerting user to enter a valid choice
        else:
            print("Please enter a valid choice, (P)roduction or (T)est")
            choice = input().lower()

    json_handlelist = dirpath + outroot + 'bothlist.txt'
    json_ssdata = dirpath + outroot + 'CID.txt'
    get_cid_ssdata(s, json_handlelist, json_ssdata)

    xlfile = dirpath + outroot + 'CID_Analysis.xls'
    write_spreadsheet(json_ssdata, xlfile)

    json_verlist = dirpath + outroot + 'ver_list.txt'
    json_doclist = dirpath + outroot + 'doc_list.txt'
    make_handle_lists(json_ssdata, json_doclist, json_verlist)

    ## Remove the files that are currently located in the collection for the CID

    if MyUtil.get_yn('Remove location (not delete) of files from ' + CID_coll[0] +'(Y/N)?: '):
        doclist = DCC.list_obj_in_coll(s, CID_coll[0],Print=True,Jwrite=False,Depth='infinity',Type='Doc')
        for doc in doclist:
            DCC.dcc_remove_doc_from_coll(s, doc, CID_coll[0])

    ## Add CID files to the collection
    fh = open(json_doclist, 'r')
    dl = json.load(fh)
    fh.close()

    if MyUtil.get_yn('Add CID files to ' + CID_coll[0] +' (Y/N)?: '):
        DCC.add_docs_2_collections(s, dl, CID_coll)

    # Check that the expected docs are in the collection
    DCC.check_docs_in_coll(s, dl, CID_coll)
开发者ID:gtrancho,项目名称:Library,代码行数:57,代码来源:CID.py

示例5: id_perm_changes

def id_perm_changes(s, handle, fd, permdata, set):
    removelist = []
    changelist = []
    addlist = []
       
    if not check_fd_sel(fd, set) or not check_perm_sel(permdata, set):
        return([removelist,changelist,addlist])
    
    for perm_act in set['PermAct']:
        # pass if no action is defined
        if not perm_act['Action']:
            pass
        elif perm_act['Action']['Action'] == 'Remove':
            for perm in permdata['perms']:
                if Match.parse(perm_act['Criteria'], perm):
                    removelist.append(perm)
        elif perm_act['Action']['Action'] == 'Change':
            for perm in permdata['perms']:
                if Match.parse(perm_act['Criteria'], perm):
                    # delete the old permission
                    newperm = perm.copy()
                    if 'Read' in perm: del(newperm['Read'])
                    if 'Write'in perm: del(newperm['Write'])
                    if 'Manage' in perm: del(newperm['Manage'])
                    for key,val in perm_act['Action']['Perms'].items():
                        newperm[key] = val
                    changelist.append(newperm)  
        elif perm_act['Action']['Action'] == 'Add':
            addFlag = True
            for perm in permdata['perms']:
                if not Match.parse(perm_act['Criteria'], perm):
                    addFlag = False
            if addFlag:
                pEntry = {}
                pEntry['handle'] = perm_act['Action']['Handle']
                grpdata = DCC.prop_get(s, pEntry['handle'], InfoSet = 'Title')
                pEntry['name'] = grpdata['title']
                if 'Read' in perm_act['Action']['Perms']:
                    pEntry['Read'] = perm_act['Action']['Perms']['Read']
                if 'Write' in perm_act['Action']['Perms']:
                    pEntry['Write'] = perm_act['Action']['Perms']['Write']
                if 'Manage' in perm_act['Action']['Perms']:
                    pEntry['Manage'] = perm_act['Action']['Perms']['Manage']
                addlist.append(pEntry) 
                
        elif perm_act['Action']['Action'] == 'Message':
            for perm in permdata['perms']:
                if Match.parse(perm_act['Criteria'], perm):
                    print(perm_act['Action']['Message'])
                    DCC.print_perm(perm, LF = True)
        
    return([removelist, changelist, addlist])
开发者ID:TMTSystemsEngineering,项目名称:Library,代码行数:52,代码来源:PERM.py

示例6: fix_permact

def fix_permact(s, fd, handle, set, **kwargs):
    # kwargs
    #   ask = True | False, Do/Don't ask if changes should be made (!!! Dangerous !!!)
    #   default is ask

    [removelist, changelist, addlist] = id_perm_changes(s,handle, fd, fd['permissions'], set) 
    ch_flag = False
    if len(removelist) or len(changelist) or len(addlist):

        DCC.print_perms(fd['permissions'])    
        print('\nSuggested Changes...')
        print_perm_changes(removelist, changelist, addlist)
        make_perm_changes(s, handle, fd['permissions'], removelist, changelist, addlist, **kwargs)
开发者ID:TMTSystemsEngineering,项目名称:Library,代码行数:13,代码来源:PERM.py

示例7: check_perms

def check_perms(s, set, handles, **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)
    for handle in handles:
        if 'Document-' in handle:
            fd = DCC.prop_get(s, handle, InfoSet = 'DocBasic')
        elif 'Collection-' in handle:
            fd = DCC.prop_get(s, handle, InfoSet = 'CollData')
        else:
            fd = DCC.prop_get(s, handle, InfoSet = 'Title')    
        fd['permissions'] = DCC.prop_get(s, handle, InfoSet = 'Perms')
#         print(fd['handle'], ':', fd['title'])    
        
        print('\n>>>>>>>>>>>>>>       DCC Information       <<<<<<<<<<<<<<')
        if 'Document-' in handle:
            DCC.print_doc_basic(fd)
        elif 'Collection-' in handle:
            DCC.print_coll_data(fd)
        else:
            print('Not Document or Collection:', handle, ':', fd['title'])   
        print('\n\tDoc Properties URL: ',Tree.url_view(handle))
        print('\tPermissions URL: ',Tree.url_perm(handle))
        print('\tGet Document URL: ',Tree.url_access(handle))

        
        print()
    
        fix_objact(s, fd, handle, set, **kwargs)
        fix_permact(s, fd, handle, set, **kwargs)
开发者ID:TMTSystemsEngineering,项目名称:Library,代码行数:32,代码来源:PERM.py

示例8: reviewColls

def reviewColls():
    
    set = top_level
    #creates sets that define the user choice to cover miscellaneous cases
    prod = ['prod', 'production', 'p', ' ']
    tes = ['test', 'tes', 't']
    checker = False
    print("Would you like to log into the production site or the test site?")
    print("Valid Inputs are as follows: Production, prod, p, test, t :", end="")
    choice = input().lower()
    #while loop to continue asking the user for input until a correct input has been entered
    while (checker == False):
        #Production site login choice
        if(choice in prod):
            print("You are now logging into the Production version of DocuShare")
            s = DCC.login(Site ='Production')
            checker = True
        #test site login choice
        elif(choice in tes):
            print("You are now logging into the test VM DocuShare")
            s = DCC.login(Site ='Test')
            checker = True
            #cf.dcc_url + cf.dcc_login 
        #error message alerting user to enter a valid choice
        else:
            print("Please enter a valid choice, (P)roduction or (T)est")
            choice = input().lower()
    yes = ['yes', 'y', 'ye']
    #creates a new boolean variable to allow user to break from loop
    checker1 = False
    print("Please enter a collection number that you would like to create a sub-collection under")
    #checker1 only true when user enters correct information 
    while(checker1 == False):
        col = input()
        parent = 'Collection-' + col
        fd = DCC.prop_get(s, parent , InfoSet = 'CollData', Print = True)
        print("Please enter the name of this new collection:")
        name = input()
        # double checks user to make sure that they would like to create this collection
        print("Are you sure that you want to create: " + name + " under " + parent)
        print("Valid Inputs are as follows: Yes, Y, No, N")
        ans = input().lower()
        # checks that user input is correct, if the answer is a valid form of yes
        # then the collection will be made and the user will break from the loop
        if(ans in yes):
            print("You are now making a collection named: " + name + " under " + parent )
            checker1 = True
            createReviewColls(s, parent, set, name)
        else:
            print("Please re-enter a Collection number and Collection name")
开发者ID:gtrancho,项目名称:Utilities,代码行数:50,代码来源:MakeColls.py

示例9: make_cid

def make_cid(dirpath, CID_coll, htmlfile, outroot):
    # Get list of DCC documents from a Word file saved as html
    GetUrlWord.get_url_word(dirpath + outroot, dirpath + htmlfile)  

    # Login to DCC
    s = DCC.login(CF.dcc_url + CF.dcc_login)

    json_handlelist = dirpath + outroot + 'bothlist.txt'
    json_ssdata = dirpath + outroot + 'CID.txt'
    get_cid_ssdata(s, json_handlelist, json_ssdata)

    xlfile = dirpath + outroot + 'CID_Analysis.xls'
    write_spreadsheet(json_ssdata, xlfile)

    json_verlist = dirpath + outroot + 'ver_list.txt'
    json_doclist = dirpath + outroot + 'doc_list.txt'
    make_handle_lists(json_ssdata, json_doclist, json_verlist)

    ## Remove the files that are currently located in the collection for the CID

    if MyUtil.get_yn('Remove location (not delete) of files from ' + CID_coll[0] +'(Y/N)?: '):
        doclist = DCC.list_obj_in_coll(s, CID_coll[0],Print=True,Jwrite=False,Depth='infinity',Type='Doc')
        for doc in doclist:
            DCC.dcc_remove_doc_from_coll(s, doc, CID_coll[0])

    ## Add CID files to the collection
    fh = open(json_doclist, 'r')
    dl = json.load(fh)
    fh.close()

    if MyUtil.get_yn('Add CID files to ' + CID_coll[0] +' (Y/N)?: '):
        DCC.add_docs_2_collections(s, dl, CID_coll)

    # Check that the expected docs are in the collection
    DCC.check_docs_in_coll(s, dl, CID_coll)
开发者ID:pbbarnes,项目名称:Library1,代码行数:35,代码来源:CID.py

示例10: createReviewColls

def createReviewColls(s,handleParent, collNames, revName): 
    for collName,subColl in collNames:
        collName = collName.replace('__NAME',revName)
        print('Creating:',handleParent,'->',collName)
        handleChild = DCC.make_collection(s, handleParent, collName, '')
        if len(subColl) > 0:
            createReviewColls(s, handleChild, subColl, revName)
开发者ID:gtrancho,项目名称:Utilities,代码行数:7,代码来源:MakeColls.py

示例11: build_tree

def build_tree(s, keyname, target, tree, **kwargs):
    # kwargs options:
    #  Exclude - List of handles to not be included in the tree

    excludeList = kwargs.get("Exclude", [])

    documents = []
    collections = []
    others = []
    dict = {}

    fd = DCC.prop_get(s, target, InfoSet="CollCont", Depth="1")

    for idx, d in enumerate(fd):
        handle = d["name"][1]
        if not handle in excludeList:
            if idx == 0:
                dict["parent"] = handle
            else:
                if "Document" in handle:
                    documents.append(handle)
                elif "Collection" in handle:
                    collections.append(handle)
                else:
                    others.append(handle)

    dict["collections"] = collections
    dict["documents"] = documents
    dict["others"] = others

    tree[keyname] = dict
    for col in collections:
        if not col in excludeList:
            tree = build_tree(s, col, col, tree, **kwargs)
    return tree
开发者ID:pbbarnes,项目名称:Library1,代码行数:35,代码来源:Tree.py

示例12: test_fix_set

def test_fix_set():
    # Login to DCC
    s = DCC.login(CF.dcc_url + CF.dcc_login)
    
    set = PERM_DEFS.setA
    handle = 'Document-27819'
        
    fix_set(s, handle, set)
开发者ID:pbbarnes,项目名称:Library1,代码行数:8,代码来源:PERM.py

示例13: test_cache

def test_cache():
    # Login to DCC
    s = DCC.login(CF.dcc_url + CF.dcc_login)
    handle = 'Collection-286' 
    fname = 'Collection-286_CollData'
    
    [flag, fd] = check_cache_fd_json(s, handle, 'CollData', fname)
    print(flag, fd)
开发者ID:pbbarnes,项目名称:Library1,代码行数:8,代码来源:FileSys.py

示例14: iter_print_tree

def iter_print_tree(s, tree, key, indent):
    branch = tree[key]
    for doc in branch['documents']:
        nameData = DCC.prop_get(s, doc, InfoSet = 'DocBasic')
        print(indent + doc)
        print(indent+'    DCC Title: ',nameData['title'],sep='') 
        print(indent+'    TMT Doc. Num.: ',nameData['tmtnum'],sep='') 
        print(indent+'    Owner: ',nameData['owner-name']) 
        print(indent+'    Filename: ',nameData['filename'],sep='')
        print(indent+'    Date Modified: ',nameData['date'],sep='')
        print(indent+'    URL: ','https://docushare.tmt.org/docushare/dsweb/ServicesLib/',doc,'/View',sep='')
    for other in branch['others']:
        nameData = DCC.prop_get(s, other, InfoSet = 'Title')
        print(indent+other, ':', nameData['title'])        
    for col in branch['collections']:
        nameData = DCC.prop_get(s, col, InfoSet = 'Title')
        print(indent+col, ':', nameData['title'])
        print(indent+'    URL: ','https://docushare.tmt.org/docushare/dsweb/ServicesLib/',col,sep='')        
        iter_print_tree(s, tree, col, indent+'    ')
开发者ID:TMTSystemsEngineering,项目名称:Library,代码行数:19,代码来源:Tree.py

示例15: xls_tree_iter

def xls_tree_iter(s,ws,tree,col, **kwargs):
    global ssrow
    # Write and format the headings in Excel
    xls_tree_headings(ws)

    collData = DCC.prop_get(s, col, InfoSet = 'Title')
    branch = tree[col]
    
    keyword = kwargs.get('Keyword', '')
    
    for doc in branch['documents']:
        print(col,doc)
        docData = DCC.prop_get(s, doc, InfoSet = 'DocBasic')
        docData['Versions'] = DCC.prop_get(s,doc,InfoSet = 'Versions',WriteProp = True)
        if keyword in docData['keywords']:
            xls_print_ssrow(ws, collData, docData, ssrow)
            ssrow += 1
    for newcol in branch['collections']:
        xls_tree_iter(s,ws,tree,newcol,**kwargs)
开发者ID:TMTSystemsEngineering,项目名称:Library,代码行数:19,代码来源:Tree.py


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