diff --git a/src/commands/default/comms.py b/src/commands/default/comms.py index c063d1b16b..661cd91cdd 100644 --- a/src/commands/default/comms.py +++ b/src/commands/default/comms.py @@ -333,13 +333,13 @@ class CmdCdestroy(MuxPlayerCommand): if not channel.access(caller, 'control'): self.msg("You are not allowed to do that.") return - - message = "%s is being destroyed. Make sure to change your aliases." % channel + channel_key = channel.key + message = "%s is being destroyed. Make sure to change your aliases." % channel_key msgobj = create.create_message(caller, message, channel) channel.msg(msgobj) channel.delete() CHANNELHANDLER.update() - self.msg("Channel '%s' was destroyed." % channel) + self.msg("Channel '%s' was destroyed." % channel_key) class CmdCBoot(MuxPlayerCommand): diff --git a/src/commands/default/help.py b/src/commands/default/help.py index 6a12e3e83d..02a11cadae 100644 --- a/src/commands/default/help.py +++ b/src/commands/default/help.py @@ -263,4 +263,4 @@ class CmdSetHelp(MuxCommand): if new_entry: self.msg("Topic '%s' was successfully created." % topicstr) else: - self.msg("Error when creating topic '%s'! Maybe it already exists?" % topicstr) + self.msg("Error when creating topic '%s'! Contact an admin." % topicstr) diff --git a/src/comms/models.py b/src/comms/models.py index ef0438b5ea..688898f7b5 100644 --- a/src/comms/models.py +++ b/src/comms/models.py @@ -99,6 +99,7 @@ class Msg(SharedMemoryModel): # Database manager objects = managers.MsgManager() + _is_deleted = False def __init__(self, *args, **kwargs): SharedMemoryModel.__init__(self, *args, **kwargs) diff --git a/src/help/models.py b/src/help/models.py index 187a39c7e8..8f97fa4069 100644 --- a/src/help/models.py +++ b/src/help/models.py @@ -64,6 +64,7 @@ class HelpEntry(SharedMemoryModel): # Database manager objects = HelpEntryManager() + _is_deleted = False def __init__(self, *args, **kwargs): SharedMemoryModel.__init__(self, *args, **kwargs) diff --git a/src/scripts/scripts.py b/src/scripts/scripts.py index 289a655a83..f7749ffa12 100644 --- a/src/scripts/scripts.py +++ b/src/scripts/scripts.py @@ -460,7 +460,7 @@ class Script(ScriptBase): Should return a boolean. The method is assumed to collect all needed information from its related self.obj. """ - return True + return not self._is_deleted def at_start(self): """ diff --git a/src/server/models.py b/src/server/models.py index 57af416bcc..0b423f6e12 100644 --- a/src/server/models.py +++ b/src/server/models.py @@ -48,6 +48,7 @@ class ServerConfig(WeakSharedMemoryModel): db_value = models.TextField(blank=True) objects = ServerConfigManager() + _is_deleted = False # Wrapper properties to easily set database fields. These are # @property decorators that allows to access these fields using diff --git a/src/tests/test_scripts_models.py b/src/tests/test_scripts_models.py index eafd1583d7..43f7ca27a9 100644 --- a/src/tests/test_scripts_models.py +++ b/src/tests/test_scripts_models.py @@ -18,7 +18,10 @@ class TestScriptDB(TestCase): self.scr = create_script(DoNothing) def tearDown(self): - self.scr.delete() + try: + self.scr.delete() + except ObjectDoesNotExist: + pass del self.scr def test_delete(self): @@ -28,15 +31,16 @@ class TestScriptDB(TestCase): def test_double_delete(self): "What should happen? Isn't it already deleted?" - self.scr.delete() - self.scr.delete() + with self.assertRaises(ObjectDoesNotExist): + self.scr.delete() + self.scr.delete() - @unittest.skip("not implemented") - def test___init__fails(self): # Users should be told not to do this - with self.assertRaises(Exception): - ScriptDB() + #@unittest.skip("not implemented") + #def test___init__fails(self): # Users should be told not to do this + # - No they should not; ScriptDB() is required internally. /Griatch + # with self.assertRaises(Exception): + # ScriptDB() - @unittest.skip("not implemented") def test_deleted_script_fails_start(self): "Would it ever be necessary to start a deleted script?" self.scr.delete() @@ -44,14 +48,11 @@ class TestScriptDB(TestCase): self.scr.start() # Check the script is not recreated as a side-effect self.assertFalse(self.scr in ScriptDB.objects.get_all_scripts()) - self.scr = create_script(DoNothing) # for tearDown() - @unittest.skip("not implemented") def test_deleted_script_is_invalid(self): "Can deleted scripts be said to be valid?" self.scr.delete() self.assertFalse(self.scr.is_valid()) # assertRaises? See issue #509 - self.scr = create_script(DoNothing) # for tearDown() if __name__ == '__main__': diff --git a/src/typeclasses/models.py b/src/typeclasses/models.py index 1f96286329..c4b03a743d 100644 --- a/src/typeclasses/models.py +++ b/src/typeclasses/models.py @@ -1206,7 +1206,7 @@ class TypedObject(SharedMemoryModel): _GA(self, "attributes").clear() if not isinstance(_GA(self, "aliases"), LazyLoadHandler): _GA(self, "aliases").clear() - if not isinstance(_GA(self, "nicks"), LazyLoadHandler): + if hasattr(self, "nicks") and not isinstance(_GA(self, "nicks"), LazyLoadHandler): _GA(self, "nicks").clear() _SA(self, "_cached_typeclass", None) _GA(self, "flush_from_cache")()