Remove qute:// backend= argument

This commit is contained in:
Florian Bruhin 2018-09-05 22:51:58 +02:00
parent dc82ac3eb2
commit 36b2f5e63f

View File

@ -114,12 +114,10 @@ class add_handler: # noqa: N801,N806 pylint: disable=invalid-name
Attributes: Attributes:
_name: The 'foo' part of qute://foo _name: The 'foo' part of qute://foo
backend: Limit which backends the handler can run with.
""" """
def __init__(self, name, backend=None): def __init__(self, name):
self._name = name self._name = name
self._backend = backend
self._function = None self._function = None
def __call__(self, function): def __call__(self, function):
@ -129,20 +127,8 @@ class add_handler: # noqa: N801,N806 pylint: disable=invalid-name
def wrapper(self, *args, **kwargs): def wrapper(self, *args, **kwargs):
"""Call the underlying function.""" """Call the underlying function."""
if self._backend is not None and objects.backend != self._backend:
return self.wrong_backend_handler(*args, **kwargs)
else:
return self._function(*args, **kwargs) return self._function(*args, **kwargs)
def wrong_backend_handler(self, url):
"""Show an error page about using the invalid backend."""
src = jinja.render('error.html',
title="Error while opening qute://url",
url=url.toDisplayString(),
error='{} is not available with this '
'backend'.format(url.toDisplayString()))
return 'text/html', src
def data_for_url(url): def data_for_url(url):
"""Get the data to show for the given URL. """Get the data to show for the given URL.