Commit 8b5ff3ad authored by Łukasz Nowak's avatar Łukasz Nowak

Compatibility and specification.

Compat: Put key as first argument.

Spec: In case of passing key (and updating shadir) require urlmd5 too.
parent ac108329
......@@ -79,8 +79,8 @@ class NetworkcacheClient(object):
elif value.startswith('http'):
self.signature_certificate_url_list.append(value)
def upload(self, file_descriptor, urlmd5=None, file_name=None,
valid_until=None, architecture=None, key=None):
def upload(self, file_descriptor, key=None, urlmd5=None, file_name=None,
valid_until=None, architecture=None):
''' Upload the file to the server.
If urlmd5 is None it must only upload to SHACACHE.
Otherwise, it must create a new entry on SHADIR.
......@@ -112,8 +112,9 @@ class NetworkcacheClient(object):
(self.shacache_host, result.status, data))
if key is not None:
if file_name is None:
raise ValueError('In case if key is given file_name is required.')
if file_name is None or urlmd5 is None:
raise ValueError('In case if key is given file_name and urlmd5 '
'are required.')
kw = dict()
kw['file'] = file_name
kw['urlmd5'] = urlmd5
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment