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,
there's a special link:qute://configdiff[] page in qutebrowser, which will show
you the changes you did in your old configuration, compared to the old defaults.
there's a special link:qute://configdiff/old[configdiff] page in qutebrowser,
which will show you the changes you did in your old configuration, compared to
the old defaults.
Other changes in default settings:

View File

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