mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-09-01 06:45:38 +00:00
Split off UI_ShowFile() from UI_Changes
UI_ShowFile() is more generic and can be used to display various (text)
files, not only diffs.
(cherry picked from commit bb3803b931
,
adjusted for 2.13 branch)
This commit is contained in:
@@ -254,14 +254,17 @@ def UI_Changes(oldprofile, newprofile, comments=False):
|
||||
else:
|
||||
difftemp = generate_diff_with_comments(oldprofile, newprofile)
|
||||
header = 'View Changes with comments'
|
||||
if UI_mode == 'json':
|
||||
jsonout = {'dialog': 'changes', 'header':header, 'filename': difftemp.name}
|
||||
write_json(jsonout)
|
||||
json_response('changes')["response"] # wait for response to delay deletion of difftemp (and ignore response content)
|
||||
else:
|
||||
subprocess.call('less %s' % difftemp.name, shell=True)
|
||||
UI_ShowFile(header, difftemp.name)
|
||||
difftemp.close()
|
||||
|
||||
def UI_ShowFile(header, filename):
|
||||
if UI_mode == 'json':
|
||||
jsonout = {'dialog': 'changes', 'header': header, 'filename': filename}
|
||||
write_json(jsonout)
|
||||
json_response('changes')["response"] # wait for response to delay deletion of filename (and ignore response content)
|
||||
else:
|
||||
subprocess.call('less %s' % filename, shell=True)
|
||||
|
||||
CMDS = {'CMD_ALLOW': _('(A)llow'),
|
||||
'CMD_OTHER': _('(M)ore'),
|
||||
'CMD_AUDIT_NEW': _('Audi(t)'),
|
||||
|
Reference in New Issue
Block a user