Some cleanup code fixes.
This commit is contained in:
parent
ec54de4797
commit
792b3c9282
6 changed files with 10 additions and 67 deletions
|
|
@ -433,5 +433,7 @@ class ChannelDB(TypedObject):
|
|||
Deletes channel while also cleaning up channelhandler
|
||||
"""
|
||||
super(ChannelDB, self).delete()
|
||||
_GA(self, "attributes").clear()
|
||||
_GA(self, "aliases").clear()
|
||||
from src.comms.channelhandler import CHANNELHANDLER
|
||||
CHANNELHANDLER.update()
|
||||
|
|
|
|||
|
|
@ -780,6 +780,10 @@ class ObjectDB(TypedObject):
|
|||
_GA(self, "clear_exits")()
|
||||
# Clear out any non-exit objects located within the object
|
||||
_GA(self, "clear_contents")()
|
||||
_GA(self, "attributes").clear()
|
||||
_GA(self, "nicks").clear()
|
||||
_GA(self, "aliases").clear()
|
||||
|
||||
# Perform the deletion of the object
|
||||
super(ObjectDB, self).delete()
|
||||
return True
|
||||
|
|
|
|||
|
|
@ -417,6 +417,9 @@ class PlayerDB(TypedObject, AbstractUser):
|
|||
self.unpuppet_object(session.sessid)
|
||||
session.sessionhandler.disconnect(session, reason=_("Player being deleted."))
|
||||
self.scripts.stop()
|
||||
_GA(self, "attributes").clear()
|
||||
_GA(self, "nicks").clear()
|
||||
_GA(self, "aliases").clear()
|
||||
super(PlayerDB, self).delete(*args, **kwargs)
|
||||
|
||||
def execute_cmd(self, raw_string, sessid=None):
|
||||
|
|
|
|||
|
|
@ -184,4 +184,5 @@ class ScriptDB(TypedObject):
|
|||
if self.delete_iter > 0:
|
||||
return
|
||||
self.delete_iter += 1
|
||||
_GA(self, "attributes").clear()
|
||||
super(ScriptDB, self).delete()
|
||||
|
|
|
|||
|
|
@ -1130,9 +1130,6 @@ class TypedObject(SharedMemoryModel):
|
|||
|
||||
def delete(self):
|
||||
"Cleaning up handlers on the typeclass level"
|
||||
_GA(self, "attributes").clear()
|
||||
_GA(self, "nicks").clear()
|
||||
_GA(self, "aliases").clear()
|
||||
_GA(self, "permissions").clear()
|
||||
super(TypedObject, self).delete()
|
||||
|
||||
|
|
|
|||
|
|
@ -295,70 +295,6 @@ class BatchCommandProcessor(object):
|
|||
commands = [c for c in commands if c]
|
||||
return commands
|
||||
|
||||
# #helper function
|
||||
# def identify_line(line):
|
||||
# """
|
||||
# Identifies the line type (comment, commanddef or empty)
|
||||
# """
|
||||
# try:
|
||||
# if line.strip().startswith("#INSERT"):
|
||||
# return "insert"
|
||||
# elif line.strip()[0] == '#':
|
||||
# return "comment"
|
||||
# else:
|
||||
# return "commanddef"
|
||||
# except IndexError:
|
||||
# return "empty"
|
||||
#
|
||||
# #read the indata, if possible.
|
||||
# lines = read_batchfile(pythonpath, file_ending='.ev')
|
||||
#
|
||||
# #line = utils.to_unicode(line)
|
||||
# if not lines:
|
||||
# return None
|
||||
#
|
||||
# commands = []
|
||||
# curr_cmd = ""
|
||||
#
|
||||
# #purge all superfluous whitespace and newlines from lines
|
||||
# reg1 = re.compile(r"\s+")
|
||||
# lines = [reg1.sub(" ", l) for l in lines]
|
||||
#
|
||||
# #parse all command definitions into a list.
|
||||
# for line in lines:
|
||||
#
|
||||
# typ = identify_line(line)
|
||||
#
|
||||
# if typ == "commanddef":
|
||||
# curr_cmd += line
|
||||
# elif typ == "empty" and curr_cmd:
|
||||
# curr_cmd += "\r\n"
|
||||
# elif typ == "insert":
|
||||
# # note that we are not safeguarding for
|
||||
# # cyclic imports here!
|
||||
# if curr_cmd:
|
||||
# commands.append(curr_cmd.strip())
|
||||
# curr_cmd = ""
|
||||
# filename = line.lstrip("#INSERT").strip()
|
||||
# insert_commands = self.parse_file(filename)
|
||||
# if insert_commands is None:
|
||||
# insert_commands = ["{rINSERT ERROR: %s{n" % filename]
|
||||
# commands.extend(insert_commands)
|
||||
# else: #comment
|
||||
# if curr_cmd:
|
||||
# commands.append(curr_cmd.strip())
|
||||
# curr_cmd = ""
|
||||
# if curr_cmd:
|
||||
# commands.append(curr_cmd.strip())
|
||||
#
|
||||
# #second round to clean up now merged line edges etc.
|
||||
# reg2 = re.compile(r"[ \t\f\v]+")
|
||||
# commands = [reg2.sub(" ", c) for c in commands]
|
||||
#
|
||||
# #remove eventual newline at the end of commands
|
||||
# commands = [c.strip('\r\n') for c in commands]
|
||||
# return commands
|
||||
|
||||
|
||||
#------------------------------------------------------------
|
||||
#
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue