예제 #1
0
def save_matches(matches):
    if matches == None or len(matches) == 0:
        ryw.give_news('save_matches: no match to save', logging.warning)
        return None

    success,tmpDir,selName = get_save_search_name()
    if not success:
        ryw.give_bad_news(
            'save_matches: failed to determine selection file name',
            logging.error)
        return None

    selList = make_selection_list(matches)

    #
    # copied from ProcessDownloadReq.py
    #
    success,tmppath,bakpath = ProcessDownloadReq.write_reqs(
        os.path.join(tmpDir, selName), set(selList))
    ProcessDownloadReq.cleanup(tmppath, bakpath)

    if not success:
        ryw.give_bad_news(
            'save_matches: ProcessDownloadReq.write_reqs failed: ' +
            os.path.join(tmpDir, selName), logging.error)
        return None

    cleanup_old_search_results(tmpDir, selName)

    return selName
예제 #2
0
def union_and_write(currSel, searchSel, queueName):

    unionResults = currSel | searchSel

    #
    # copied from ProcessDownloadReq.py
    #
    success,tmppath,bakpath = ProcessDownloadReq.write_reqs(
        queueName, unionResults)
    ProcessDownloadReq.cleanup(tmppath, bakpath)

    if success:
        numResults = len(searchSel)
        ryw.give_news(str(numResults) +
                      ' objects added to the chosen selection.',
                      logging.info)
    else:
        ryw.give_bad_news('union_and_write: failed.', logging.error)