Call super().setValue() before defaultHttpHeaders.

To prevent infinite recursion on startup, because defaultHttpHeaders
gets the value; which is unset, so 'registry._lastModified > self._lastModified'
is True, so .set() is called, so .setValue() is called again.
This commit is contained in:
Valentin Lorentz 2020-01-17 19:49:16 +01:00
parent c457b52067
commit 895881e66e

View File

@ -1318,14 +1318,15 @@ class HttpRequestLanguage(registry.String):
"""Must be a valid HTTP Accept-Language value.""" """Must be a valid HTTP Accept-Language value."""
__slots__ = () __slots__ = ()
def setValue(self, v): def setValue(self, v):
utils.web.defaultHeaders = defaultHttpHeaders(None, None)
super(HttpRequestLanguage, self).setValue(v) super(HttpRequestLanguage, self).setValue(v)
utils.web.defaultHeaders = defaultHttpHeaders(None, None)
registerChannelValue(supybot.protocols.http, 'requestLanguage', registerChannelValue(supybot.protocols.http, 'requestLanguage',
HttpRequestLanguage('', _("""If set, the Accept-Language HTTP header will be set to this HttpRequestLanguage('', _("""If set, the Accept-Language HTTP header will be set to this
value for requests. Useful for overriding the auto-detected language based on value for requests. Useful for overriding the auto-detected language based on
the server's location."""))) the server's location.""")))
### ###
# supybot.protocols.ssl # supybot.protocols.ssl
### ###