From 2dd322e721cf8f4f9f52c8d2c4f83c31efb1a3bc Mon Sep 17 00:00:00 2001 From: BlauFeuer Date: Mon, 4 Sep 2017 09:20:49 -0400 Subject: [PATCH] suggested refactor Extract into a separate variable (note), then % interpolate it. --- evennia/commands/default/building.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/evennia/commands/default/building.py b/evennia/commands/default/building.py index 8f71d055be..4a1638bd84 100644 --- a/evennia/commands/default/building.py +++ b/evennia/commands/default/building.py @@ -954,9 +954,9 @@ class CmdLink(COMMAND_DEFAULT_CLASS): return string = "" + note = "Note: %s(%s) did not have a destination set before. Make sure you linked the right thing." if not obj.destination: - string += "Note: %s(%s) did not have a destination set before." \ - " Make sure you linked the right thing." % (obj.name, obj.dbref) + string = note % (obj.name, obj.dbref) if "twoway" in self.switches: if not (target.location and obj.location): string = "To create a two-way link, %s and %s must both have a location" % (obj, target) @@ -964,8 +964,7 @@ class CmdLink(COMMAND_DEFAULT_CLASS): self.caller.msg(string) return if not target.destination: - string += "\nNote: %s(%s) did not have a destination set before." \ - " Make sure you linked the right thing." % (target.name, target.dbref) + string += note % (target.name, target.dbref) obj.destination = target.location target.destination = obj.location string += "\nLink created %s (in %s) <-> %s (in %s) (two-way)." %\