Code review comment for lp:~asac/gwibber/access_not_defined_msg_attr

Revision history for this message
Alexander Sack (asac) wrote :

while reviewing indicate backport for jaunty, i found some oddity, that i think is logically wrong. Here what i said on irc:

21:30 < asac> its probably a theoretical issue, but wrong imo:
21:31 < asac> so first a message runs this:
21:31 < asac> if hasattr(message, "gId"):
21:31 < asac> message.is_duplicate = message.gId in seen
21:31 < asac> message.first_seen = False
21:31 < asac> then in the indicator code it runs:
21:31 < asac> if msg.first_seen and \
21:31 < asac> hasattr(msg, "is_unread") and msg.is_unread and \
21:31 < asac> hasattr(msg, "gId") and msg.gId not in self.indicator_items:
21:31 < asac> i think logcally it needs hasattr(msg.first_seen) and ...
21:31 < asac> or the first_seen needs to be moved after the "hasattr(msg, "gId")"
21:32 < asac> if you access msg.first_seen without it being defined it throws, right?
21:33 < asac> so given that first_seen only gets defined if hasattr(message, "gId"): the second msg.first_seen can throw (in theory)
21:34 < asac> would only happen if !hasattr(msg, "gId") ... i looked and that seems to be an unlikely event

« Back to merge proposal