Make qute://configdiff usable with the new config too

Closes #2983
This commit is contained in:
Florian Bruhin 2017-09-26 19:39:47 +02:00
parent 1704438777
commit 8e000dfe54
2 changed files with 14 additions and 9 deletions

View File

@ -11,8 +11,9 @@ Migrating older configurations
------------------------------ ------------------------------
qutebrowser does no automatic migration for the new configuration. However, qutebrowser does no automatic migration for the new configuration. However,
there's a special link:qute://configdiff[] page in qutebrowser, which will show there's a special link:qute://configdiff/old[configdiff] page in qutebrowser,
you the changes you did in your old configuration, compared to the old defaults. which will show you the changes you did in your old configuration, compared to
the old defaults.
Other changes in default settings: Other changes in default settings:

View File

@ -408,11 +408,15 @@ def qute_settings(url):
@add_handler('configdiff') @add_handler('configdiff')
def qute_configdiff(_url): def qute_configdiff(url):
"""Handler for qute://configdiff.""" """Handler for qute://configdiff."""
try: if url.path() == '/old':
return 'text/html', configdiff.get_diff() try:
except OSError as e: return 'text/html', configdiff.get_diff()
error = (b'Failed to read old config: ' + except OSError as e:
str(e.strerror).encode('utf-8')) error = (b'Failed to read old config: ' +
return 'text/plain', error str(e.strerror).encode('utf-8'))
return 'text/plain', error
else:
data = config.instance.dump_userconfig().encode('utf-8')
return 'text/plain', data