Added an error_check_python_modules function to evennia.py. This basically imports a host of critical modules and quits with tracebacks if there are problems. This catches pure python-syntax errors (i.e. cases where the source-file itself is malformed), something which is hard to properly handle in the running server (where there's also an issue as to how to best report it). Best they fail out already at an early stage.
This commit is contained in:
parent
e379816866
commit
703accdd60
7 changed files with 59 additions and 9 deletions
|
|
@ -243,10 +243,10 @@ class CmdSet(object):
|
|||
# add all commands
|
||||
if not hasattr(cmd, 'obj'):
|
||||
cmd.obj = self.cmdsetobj
|
||||
ic = [i for i, oldcmd in enumerate(self.commands) if oldcmd.match(cmd)]
|
||||
if ic:
|
||||
self.commands[ic[0]] = cmd # replace
|
||||
else:
|
||||
try:
|
||||
ic = self.commands.index(cmd)
|
||||
self.commands[ic] = cmd # replace
|
||||
except ValueError:
|
||||
self.commands.append(cmd)
|
||||
# extra run to make sure to avoid doublets
|
||||
self.commands = list(set(self.commands))
|
||||
|
|
|
|||
|
|
@ -121,7 +121,8 @@ def import_cmdset(python_path, cmdsetobj, emit_to_obj=None, no_logging=False):
|
|||
logger.log_trace()
|
||||
if emit_to_obj and not ServerConfig.objects.conf("server_starting_mode"):
|
||||
object.__getattribute__(emit_to_obj, "msg")(errstring)
|
||||
#raise # have to raise, or we will not see any errors in some situations!
|
||||
logger.log_errmsg("Error: %s" % errstring)
|
||||
raise # have to raise, or we will not see any errors in some situations!
|
||||
|
||||
# classes
|
||||
|
||||
|
|
@ -246,8 +247,8 @@ class CmdSetHandler(object):
|
|||
def add(self, cmdset, emit_to_obj=None, permanent=False):
|
||||
"""
|
||||
Add a cmdset to the handler, on top of the old ones.
|
||||
Default is to not make this permanent (i.e. no script
|
||||
will be added to add the cmdset every server start/login).
|
||||
Default is to not make this permanent, i.e. the set
|
||||
will not survive a server reset.
|
||||
|
||||
cmdset - can be a cmdset object or the python path to
|
||||
such an object.
|
||||
|
|
|
|||
|
|
@ -616,7 +616,7 @@ class CmdOOCLook(CmdLook):
|
|||
self.character = None
|
||||
if utils.inherits_from(self.caller, "src.objects.objects.Object"):
|
||||
# An object of some type is calling. Convert to player.
|
||||
print self.caller, self.caller.__class__
|
||||
#print self.caller, self.caller.__class__
|
||||
self.character = self.caller
|
||||
if hasattr(self.caller, "player"):
|
||||
self.caller = self.caller.player
|
||||
|
|
|
|||
|
|
@ -68,6 +68,13 @@ class ObjectManager(TypedObjectManager):
|
|||
# use the id to find the player
|
||||
return self.get_object_with_user(dbref)
|
||||
|
||||
@returns_typeclass_list
|
||||
def get_objs_with_key_and_typeclass(oname, otypeclass_path):
|
||||
"""
|
||||
Returns objects based on simultaneous key and typeclass match.
|
||||
"""
|
||||
return self.filter(db_key__iexact=oname).filter(db_typeclass_path_exact=otypeclass_path)
|
||||
|
||||
# attr/property related
|
||||
|
||||
@returns_typeclass_list
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue