Exemplo n.º 1
0
def decrypt_blob_to_filepaths(blobdir, localindex, fhash, secret):
    """
    @param blobdir: str or unicode
    @type blobdir:
    @param localindex: dict
    @type localindex:
    @param fhash: str or unicode
    @type fhash:
    @param secret: str or unicode
    @type secret:
    """

    #noinspection PyBroadException
    try:
        fdir = os.path.join(blobdir, fhash[:2])
        return decrypt_write_file(localindex, fdir, fhash, secret)
    except Exception:
        handle_ex(False)
Exemplo n.º 2
0
def main():
    # noinspection PyUnusedLocal
    (options, args) = add_options()

    try:
        cryptobox_command(options)
    except Exception:
        exs = handle_ex(False, True)
        output_json({"error_message": exs})

        raise
Exemplo n.º 3
0
def main():
    #noinspection PyUnusedLocal
    (options, args) = add_options()

    try:
        cryptobox_command(options)
    except Exception:
        exs = handle_ex(False, True)
        output_json({"error_message": exs})

        raise
Exemplo n.º 4
0
        rel_path = save_encode_b64(rel_file_path)
        params = {'file': file_object,
                  "uuid": uuid.uuid4().hex,
                  "parent": parent,
                  "path": rel_path,
                  "ufile_name": os.path.basename(file_object.name)}

        poster.encode.MultipartParam.last_cb_time = time.time()
        datagen, headers = poster.encode.multipart_encode(params, cb=prog_callback)
        request = urllib2.Request(service, datagen, headers)

        #noinspection PyUnusedLocal
        result = urllib2.urlopen(request)
        return file_path
    except Exception:
        handle_ex(False)


def possible_new_dirs(file_path, memory):
    """
    @type file_path: str, unicode
    @type memory: Memory
    """
    if file_path is None:
        raise Exception("file_path is None")

    possible_new_dir_list = []
    file_dir = os.path.dirname(file_path)
    rel_unix_path = path_to_relative_path_unix_style(memory, file_dir)
    unix_paths = rel_unix_path.split("/")
    tmp_dir = ""