From: W. Trevor King Date: Fri, 7 Mar 2014 04:21:07 +0000 (-0800) Subject: irkerd: Add Target.__str__ for pretty-printing targets in log messages X-Git-Tag: 2.7~25 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=dde3c700cd93680dd9a9898fe30204f6ae36e7de;p=irker.git irkerd: Add Target.__str__ for pretty-printing targets in log messages Prefer the servername, falling back to the URL, falling back to Target.__repr__(). --- diff --git a/irkerd b/irkerd index c5fc1ae..bad14f9 100755 --- a/irkerd +++ b/irkerd @@ -640,6 +640,11 @@ class Target(): if parsed.query: self.key = re.sub("^key=", "", parsed.query) self.port = int(ircport) + + def __str__(self): + "Represent this instance as a string" + return self.servername or self.url or repr(self) + def validate(self): "Raise InvalidRequest if the URL is missing a critical component" if not self.servername: