Commit 07dc01a2 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[common] Fix diff parameters

Don't use python keywords as variable name.
parent 63a576a3
......@@ -696,7 +696,7 @@ def pull(webapi, prefix, type, names, fields, force, indentation):
return status, list(available)
def diff(webapi, prefix, type, name, fields):
def diff(webapi, prefix, type_, name, fields):
"""Shows the differences between two objects, for each of the fields
......@@ -737,8 +737,8 @@ def diff(webapi, prefix, type, name, fields):
def _eval_diff(remote, local, ext):
'''Calculates differences between two string buffers'''
return difflib.unified_diff(remote.split('\n'), local.split('\n'),
os.path.join('remote', type, name + ext),
os.path.join('local', type, name + ext))
os.path.join('remote', type_, name + ext),
os.path.join('local', type_, name + ext))
def _show_diff(diffs):
......@@ -750,9 +750,9 @@ def diff(webapi, prefix, type, name, fields):
else: print(line)
storage = TYPE_STORAGE[type](prefix, name)
storage = TYPE_STORAGE[type_](prefix, name)
local = storage.load() #may also return a tuple, depending on the type
remote = fetch_object(webapi, type, name, fields)
remote = fetch_object(webapi, type_, name, fields)
if remote is None: return 1
if 'declaration' in remote and \
not isinstance(remote['declaration'], six.string_types):
......@@ -767,12 +767,12 @@ def diff(webapi, prefix, type, name, fields):
for field in fields:
diffs = _eval_diff(remote[field], local[field], extension[field])
if diffs:
logger.info("differences for `%s' of `%s/%s':", field, TYPE_PLURAL[type],
logger.info("differences for `%s' of `%s/%s':", field, TYPE_PLURAL[type_],
name)
_show_diff(diffs)
else:
logger.info("no differences for `%s' of `%s/%s'", field,
TYPE_PLURAL[type], name)
TYPE_PLURAL[type_], name)
return 0
......
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