Fix KeyError when using backend-specific updates formatter
When a backend-specific formatter (i.e. ``{Pacman}``, ``{Cower}``, etc.) is used, and the initial "working" status is set, the loop in which the update totals is compiled has not yet run, leading to a KeyError. This commit fixes the traceback by setting initial values of "?" for these formatters before the initial "working" status is set.
This commit is contained in:
parent
c287204321
commit
2a886ffa1e
@ -92,6 +92,11 @@ class Updates(Module):
|
|||||||
|
|
||||||
@require(internet)
|
@require(internet)
|
||||||
def check_updates(self):
|
def check_updates(self):
|
||||||
|
for backend in self.backends:
|
||||||
|
key = backend.__class__.__name__
|
||||||
|
if key not in self.data:
|
||||||
|
self.data[key] = '?'
|
||||||
|
|
||||||
self.output = {
|
self.output = {
|
||||||
"full_text": formatp(self.format_working, **self.data).strip(),
|
"full_text": formatp(self.format_working, **self.data).strip(),
|
||||||
"color": self.color_working,
|
"color": self.color_working,
|
||||||
|
Loading…
Reference in New Issue
Block a user