Perform user expansion when uploading files from the CLI.

Don't ignore missing files - allow an exception to be raised.
Add extra CLI file upload unit tests.
This commit is contained in:
sneakypete81 2013-12-07 17:05:28 +00:00
parent 4deceb6e8e
commit b7fe17656b
2 changed files with 32 additions and 3 deletions

View file

@ -122,9 +122,8 @@ def extract_files(params):
files = {}
updated_params = {}
for name in params:
if (name == "photo" and params[name].startswith("@") and
os.path.isfile(os.path.expanduser(params[name][1:]))):
files[name] = open(params[name][1:], 'rb')
if name == "photo" and params[name].startswith("@"):
files[name] = open(os.path.expanduser(params[name][1:]), 'rb')
else:
updated_params[name] = params[name]