Made a better check for cleaning module names, should resolve Issue 319.

This commit is contained in:
Griatch 2012-10-28 14:38:17 +01:00
parent 52af816977
commit 20d6de5104
2 changed files with 4 additions and 3 deletions

View file

@ -281,7 +281,8 @@ class CmdGet(MuxCommand):
if caller == obj: if caller == obj:
caller.msg("You can't get yourself.") caller.msg("You can't get yourself.")
return return
if obj.location == caller: print obj, obj.location, caller, caller==obj.location
if caller == obj.location:
caller.msg("You already hold that.") caller.msg("You already hold that.")
return return
if not obj.access(caller, 'get'): if not obj.access(caller, 'get'):

View file

@ -6,7 +6,7 @@ be of use when designing your own game.
""" """
import os, sys, imp, types, math import os, sys, imp, types, math, re
import textwrap, datetime, random import textwrap, datetime, random
from inspect import ismodule from inspect import ismodule
from collections import defaultdict from collections import defaultdict
@ -837,7 +837,7 @@ def mod_import(module):
if not os.path.isabs(module): if not os.path.isabs(module):
module = os.path.abspath(module) module = os.path.abspath(module)
path, filename = module.rsplit(os.path.sep, 1) path, filename = module.rsplit(os.path.sep, 1)
modname = filename.rstrip('.py') modname = re.sub(r"\.py$", "", filename)
try: try:
result = imp.find_module(modname, [path]) result = imp.find_module(modname, [path])