Fixed a bug in help. Resolves #955.
This commit is contained in:
parent
02ba1c0695
commit
72bdc66022
1 changed files with 9 additions and 12 deletions
|
|
@ -196,27 +196,24 @@ class CmdSetHelp(MuxCommand):
|
||||||
lhslist = self.lhslist
|
lhslist = self.lhslist
|
||||||
|
|
||||||
if not self.args:
|
if not self.args:
|
||||||
self.msg("Usage: @sethelp/[add|del|append|merge] <topic>[,category[,locks,..] = <text>")
|
self.msg("Usage: @sethelp[/switches] <topic>[,category[,locks,..] = <text>")
|
||||||
return
|
return
|
||||||
|
|
||||||
topicstr = ""
|
nlist = len(lhslist)
|
||||||
category = "General"
|
topicstr = lhslist[0] if nlist > 0 else ""
|
||||||
lockstring = "view:all()"
|
|
||||||
try:
|
|
||||||
topicstr = lhslist[0]
|
|
||||||
category = lhslist[1]
|
|
||||||
lockstring = ",".join(lhslist[2:])
|
|
||||||
except Exception:
|
|
||||||
pass
|
|
||||||
|
|
||||||
if not topicstr:
|
if not topicstr:
|
||||||
self.msg("You have to define a topic!")
|
self.msg("You have to define a topic!")
|
||||||
return
|
return
|
||||||
|
|
||||||
# check if we have an old entry with the same name
|
# check if we have an old entry with the same name
|
||||||
try:
|
try:
|
||||||
old_entry = HelpEntry.objects.get(db_key__iexact=topicstr)
|
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:
|
except Exception:
|
||||||
old_entry = None
|
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:
|
if 'append' in switches or "merge" in switches:
|
||||||
# merge/append operations
|
# merge/append operations
|
||||||
|
|
@ -254,7 +251,7 @@ class CmdSetHelp(MuxCommand):
|
||||||
old_entry.locks.clear()
|
old_entry.locks.clear()
|
||||||
old_entry.locks.add(lockstring)
|
old_entry.locks.add(lockstring)
|
||||||
old_entry.save()
|
old_entry.save()
|
||||||
self.msg("Overwrote the old topic '%s' with a new one." % topicstr)
|
self.msg("Overwrote the old topic '%s'." % topicstr)
|
||||||
else:
|
else:
|
||||||
self.msg("Topic '%s' already exists. Use /force to overwrite or /append or /merge to add text to it." % topicstr)
|
self.msg("Topic '%s' already exists. Use /force to overwrite or /append or /merge to add text to it." % topicstr)
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue