fix wallet bug in labels plugin
This commit is contained in:
parent
a4cb70649d
commit
5918bac5cb
|
@ -225,6 +225,7 @@ class Plugin(BasePlugin):
|
||||||
if "error" in response:
|
if "error" in response:
|
||||||
raise BaseException(_("Could not sync labels: %s" % response["error"]))
|
raise BaseException(_("Could not sync labels: %s" % response["error"]))
|
||||||
|
|
||||||
|
result = {}
|
||||||
for label in response:
|
for label in response:
|
||||||
try:
|
try:
|
||||||
key = self.decode(label["external_id"])
|
key = self.decode(label["external_id"])
|
||||||
|
@ -240,8 +241,14 @@ class Plugin(BasePlugin):
|
||||||
except:
|
except:
|
||||||
print_error('error: no json', key)
|
print_error('error: no json', key)
|
||||||
continue
|
continue
|
||||||
if force or not self.wallet.labels.get(key):
|
result[key] = value
|
||||||
self.wallet.labels[key] = value
|
|
||||||
self.wallet.storage.put('labels', self.wallet.labels)
|
wallet = self.wallet
|
||||||
|
if not wallet:
|
||||||
|
return
|
||||||
|
for key, value in result.items():
|
||||||
|
if force or not wallet.labels.get(key):
|
||||||
|
wallet.labels[key] = value
|
||||||
|
wallet.storage.put('labels', wallet.labels)
|
||||||
print_error("received %d labels"%len(response))
|
print_error("received %d labels"%len(response))
|
||||||
self.window.labelsChanged.emit()
|
self.window.labelsChanged.emit()
|
||||||
|
|
Loading…
Reference in New Issue