From 115df22474879c0c4cd418c5956247d3c5c721f9 Mon Sep 17 00:00:00 2001 From: Siddharth Ravikumar Date: Thu, 26 Feb 2015 02:03:39 -0500 Subject: modded combox.crypto.decrypt_and_glue - added new arg called `write' - 'write' is set to True by set default. - If `write' is set, then the reconstructed file content is written to disk. --- combox/crypto.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/combox/crypto.py b/combox/crypto.py index 273de71..e7752d2 100644 --- a/combox/crypto.py +++ b/combox/crypto.py @@ -127,14 +127,14 @@ def split_and_encrypt(fpath, config, fcontent=None): write_shards(ciphered_shards, nodes, f_basename) -def decrypt_and_glue(fpath, config): +def decrypt_and_glue(fpath, config, write=True): """ Reads encrypted shards, decrypts and glues them. fpath: The path to file that has to be decrypted & glued from the nodes. config: The dictionary containing the combox configuration information. - + write: If set, writes the reconstructed file's content to disk. """ rel_path = relative_path(fpath, config) @@ -152,5 +152,8 @@ def decrypt_and_glue(fpath, config): # glue them together f_content = glue_data(f_parts) - # write the glued content to fpath - write_file(f, f_content) + if write: + # write the glued content to fpath + write_file(f, f_content) + + return f_content -- cgit v1.2.3