websettings: Improve errors when setting settings=...

This commit is contained in:
Florian Bruhin 2017-06-06 15:54:13 +02:00
parent b1a0bc13f2
commit 1b0a125cf3
2 changed files with 7 additions and 3 deletions

View File

@ -102,7 +102,9 @@ class DefaultProfileSetter(websettings.Base):
return utils.get_repr(self, setter=self._setter, constructor=True)
def _set(self, value, settings=None):
utils.unused(settings)
if settings is not None:
raise ValueError("'settings' may not be set with "
"DefaultProfileSetters!")
setter = getattr(default_profile, self._setter)
setter(value)
@ -119,7 +121,9 @@ class PersistentCookiePolicy(DefaultProfileSetter):
return config.get('content', 'cookies-store')
def _set(self, value, settings=None):
utils.unused(settings)
if settings is not None:
raise ValueError("'settings' may not be set with "
"PersistentCookiePolicy!")
setter = getattr(QWebEngineProfile.defaultProfile(), self._setter)
setter(
QWebEngineProfile.AllowPersistentCookies if value else

View File

@ -163,7 +163,7 @@ class StaticSetter(Setter):
def _set(self, value, settings=None):
if settings is not None:
raise ValueError("'settings' may not be set with GlobalSetters!")
raise ValueError("'settings' may not be set with StaticSetters!")
args = list(self._args)
if self._unpack:
args.extend(value)