Exemple #1
0
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)
Exemple #2
0
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)
Exemple #3
0
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)