server: Fix device printing if some fields are None.

This commit is contained in:
Damir Jelić 2019-01-14 17:12:49 +01:00
parent 062a736217
commit 11b960e22c

View file

@ -1001,9 +1001,11 @@ class MatrixServer(object):
lines = [] lines = []
for device in response.devices: for device in response.devices:
last_seen_date = ("?" if not device.last_seen_date else
device.last_seen_date.strftime("%Y/%m/%d %H:%M"))
last_seen = "{ip} @ {date}".format( last_seen = "{ip} @ {date}".format(
ip=device.last_seen_ip, ip=device.last_seen_ip or "?",
date=device.last_seen_date.strftime("%Y/%m/%d %H:%M") date=last_seen_date
) )
device_color = ("chat_self" if device.id == self.device_id else device_color = ("chat_self" if device.id == self.device_id else
W.info_get("nick_color_name", device.id)) W.info_get("nick_color_name", device.id))
@ -1013,7 +1015,7 @@ class MatrixServer(object):
W.color(device_color), W.color(device_color),
device.id, device.id,
W.color("resetcolor"), W.color("resetcolor"),
device.display_name, device.display_name or "",
last_seen last_seen
) )
lines.append(line) lines.append(line)