From 72bdc660228f70e82ec3036d22ad0b8ed5c04148 Mon Sep 17 00:00:00 2001 From: Griatch Date: Thu, 14 Apr 2016 21:32:41 +0200 Subject: [PATCH] Fixed a bug in help. Resolves #955. --- evennia/commands/default/help.py | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/evennia/commands/default/help.py b/evennia/commands/default/help.py index 2d7dd225de..713dfc4df6 100644 --- a/evennia/commands/default/help.py +++ b/evennia/commands/default/help.py @@ -196,27 +196,24 @@ class CmdSetHelp(MuxCommand): lhslist = self.lhslist if not self.args: - self.msg("Usage: @sethelp/[add|del|append|merge] [,category[,locks,..] = ") + self.msg("Usage: @sethelp[/switches] [,category[,locks,..] = ") return - topicstr = "" - category = "General" - lockstring = "view:all()" - try: - topicstr = lhslist[0] - category = lhslist[1] - lockstring = ",".join(lhslist[2:]) - except Exception: - pass - + nlist = len(lhslist) + topicstr = lhslist[0] if nlist > 0 else "" if not topicstr: self.msg("You have to define a topic!") return + # check if we have an old entry with the same name try: old_entry = HelpEntry.objects.get(db_key__iexact=topicstr) + category = lhslist[1] if nlist > 1 else old_entry.help_category + lockstring = ",".join(lhslist[2:]) if nlist > 2 else old_entry.locks.get() except Exception: old_entry = None + category = lhslist[1] if nlist > 1 else "General" + lockstring = ",".join(lhslist[2:]) if nlist > 2 else "view:all()" if 'append' in switches or "merge" in switches: # merge/append operations @@ -254,7 +251,7 @@ class CmdSetHelp(MuxCommand): old_entry.locks.clear() old_entry.locks.add(lockstring) old_entry.save() - self.msg("Overwrote the old topic '%s' with a new one." % topicstr) + self.msg("Overwrote the old topic '%s'." % topicstr) else: self.msg("Topic '%s' already exists. Use /force to overwrite or /append or /merge to add text to it." % topicstr) else: