Cédric Krier pushed to branch branch/default at Tryton / Tryton
Commits:
5d0deed6 by Cédric Krier at 2023-01-22T00:06:38+01:00
Skip unknown icon instead of trying to read it again
Closes #3722
- - - - -
1 changed file:
- tryton/tryton/common/common.py
Changes:
=====================================
tryton/tryton/common/common.py
=====================================
@@ -104,6 +104,8 @@
try:
icon_ref = (cls._name2id[iconname], iconname)
except KeyError:
+ logger.error(f"Unknown icon {iconname}")
+ cls._icons[iconname] = None
return
idx = cls._tryton_icons.index(icon_ref)
to_load = slice(max(0, idx - cls.batchnum // 2),
@@ -128,9 +130,10 @@
colors = CONFIG['icon.colors'].split(',')
cls.register_icon(iconname)
if iconname not in cls._pixbufs[(size, badge)]:
+ data = None
if iconname in cls._icons:
data = cls._icons[iconname]
elif iconname in cls._local_icons:
path = cls._local_icons[iconname]
with open(path, 'rb') as fp:
data = fp.read()
@@ -131,10 +134,10 @@
if iconname in cls._icons:
data = cls._icons[iconname]
elif iconname in cls._local_icons:
path = cls._local_icons[iconname]
with open(path, 'rb') as fp:
data = fp.read()
- else:
+ if not data:
logger.error("Unknown icon %s" % iconname)
return
if not color:
View it on Heptapod:
https://foss.heptapod.net/tryton/tryton/-/commit/5d0deed6dde562b04b9b0d008f400e1439f57042
--
View it on Heptapod:
https://foss.heptapod.net/tryton/tryton/-/commit/5d0deed6dde562b04b9b0d008f400e1439f57042
You're receiving this email because of your account on foss.heptapod.net.