summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-10-30 20:07:46 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-10-30 20:07:46 +0900
commit1dbf267aa6565bc4ad703367364dd1ee40f5bb72 (patch)
treecb965d7e3871e6056bffa968fe8546c3300158b2
parent051dd9ccbdd9dccc7bd4d20ab88ff96f0891e9fd (diff)
downloadbuildstream-1dbf267aa6565bc4ad703367364dd1ee40f5bb72.tar.gz
_frontend/widget.py: Prettier formatting of messages with no associated plugin
These come exclusively from the frontend or _pipeline.py code, we just avoid printing an element name or cache key for these messages.
-rw-r--r--buildstream/_frontend/widget.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/buildstream/_frontend/widget.py b/buildstream/_frontend/widget.py
index 8b55b39ee..e1ea4e04b 100644
--- a/buildstream/_frontend/widget.py
+++ b/buildstream/_frontend/widget.py
@@ -179,11 +179,11 @@ class ElementName(Widget):
def render(self, message):
element_id = message.task_id or message.unique_id
- if element_id is not None:
- plugin = _plugin_lookup(element_id)
- name = plugin.name
- else:
- name = ''
+ if element_id is None:
+ return ""
+
+ plugin = _plugin_lookup(element_id)
+ name = plugin.name
# Sneak the action name in with the element name
action_name = message.action_name
@@ -226,10 +226,12 @@ class CacheKey(Widget):
missing = False
key = ' ' * self.key_length
element_id = message.task_id or message.unique_id
- if element_id is not None:
- plugin = _plugin_lookup(element_id)
- if isinstance(plugin, Element):
- _, key, missing = plugin._get_full_display_key()
+ if element_id is None:
+ return ""
+
+ plugin = _plugin_lookup(element_id)
+ if isinstance(plugin, Element):
+ _, key, missing = plugin._get_full_display_key()
if message.message_type in [MessageType.FAIL, MessageType.BUG]:
text = self.err_profile.fmt(key)