Fixed a bug in amp that made reloading not work.

This commit is contained in:
Griatch 2013-09-21 22:00:46 +02:00
parent e36c7d5cc1
commit 2ba16e155e
8 changed files with 39 additions and 43 deletions

View file

@ -272,10 +272,11 @@ class CmdChannels(MuxPlayerCommand):
# full listing (of channels caller is able to listen to)
comtable = prettytable.PrettyTable(["{wsub","{wchannel","{wmy aliases","{wlocks","{wdescription"])
for chan in channels:
nicks = [nick for nick in caller.nicks.get(category="channel")]
comtable.add_row([chan in subs and "{gYes{n" or "{rNo{n",
nicks = caller.nicks.get(category="channel")
if nicks:
comtable.add_row([chan in subs and "{gYes{n" or "{rNo{n",
"%s%s" % (chan.key, chan.aliases and "(%s)" % ",".join(chan.aliases) or ""),
"%s".join(nick.db_nick for nick in nicks if nick.db_real.lower()==clower()),
"%s".join(nick.db_nick for nick in make_iter(nicks) if nick.db_real.lower()==clower()),
chan.locks,
chan.desc])
caller.msg("\n{wAvailable channels{n (use {wcomlist{n,{waddcom{n and {wdelcom{n to manage subscriptions):\n%s" % comtable)

View file

@ -17,6 +17,7 @@ from src.scripts.models import ScriptDB
from src.objects.models import ObjectDB
from src.players.models import PlayerDB
from src.utils import logger, utils, gametime, create, is_pypy, prettytable
from src.utils.utils import crop
from src.commands.default.muxcommand import MuxCommand
# delayed imports
@ -213,24 +214,17 @@ def format_script_list(scripts):
table.align = 'r'
for script in scripts:
nextrep = script.time_until_next_repeat()
#print ([script.id,
# (not hasattr(script, 'obj') or not script.obj) and "<Global>" or script.obj.key,
# script.key,
# (not hasattr(script, 'interval') or script.interval < 0) and "--" or "%ss" % script.interval,
# not nextrep and "--" or "%ss" % nextrep,
# (not hasattr(script, 'repeats') or not script.repeats) and "--" or "%i" % script.repeats,
# script.persistent and "*" or "-",
# script.typeclass_path.rsplit('.', 1)[-1],
# script.desc])
print type(script),
print script.key
table.add_row([script.id,
(not hasattr(script, 'obj') or not script.obj) and "<Global>" or script.obj.key,
script.obj.key if (hasattr(script, 'obj') and script.obj) else "<Global>",
script.key,
(not hasattr(script, 'interval') or script.interval < 0) and "--" or "%ss" % script.interval,
not nextrep and "--" or "%ss" % nextrep,
(not hasattr(script, 'repeats') or not script.repeats) and "--" or "%i" % script.repeats,
script.persistent and "*" or "-",
script.interval if script.interval > 0 else "--",
"%ss" % nextrep if nextrep else "--",
"%i" % script.repeats if script.repeats else "--",
"*" if script.persistent else "-",
script.typeclass_path.rsplit('.', 1)[-1],
script.desc])
crop(script.desc, width=20)])
return "%s" % table

View file

@ -31,11 +31,11 @@ _RE = re.compile(r"^\+|-+\+|\+-+|--*|\|", re.MULTILINE)
# ------------------------------------------------------------
class TestPlayerClass(Player):
def msg(self, message, **kwargs):
def msg(self, text="", **kwargs):
"test message"
if not self.ndb.stored_msg:
self.ndb.stored_msg = []
self.ndb.stored_msg.append(message)
self.ndb.stored_msg.append(text)
def _get_superuser(self):
"test with superuser flag"
return self.ndb.is_superuser