mirror of
https://github.com/evennia/evennia.git
synced 2026-04-07 00:45:22 +02:00
Gave a more informative error message when reading non-UTF-8 batchfiles containing international symbols (issue97) as well as refactored the processors a bit further. Fixed some minor typographic details in some other commands.
This commit is contained in:
parent
76edd254b0
commit
933e29afee
6 changed files with 115 additions and 73 deletions
|
|
@ -149,11 +149,11 @@ def get_evennia_version():
|
|||
except IOError:
|
||||
return "Unknown version"
|
||||
|
||||
def pypath_to_realpath(python_path, file_ending='py'):
|
||||
def pypath_to_realpath(python_path, file_ending='.py'):
|
||||
"""
|
||||
Converts a path on dot python form (e.g. src.objects.models)
|
||||
to a system path (src/objects/models.py). Calculates all
|
||||
paths starting from the evennia main directory.
|
||||
Converts a path on dot python form (e.g. 'src.objects.models') to
|
||||
a system path (src/objects/models.py). Calculates all paths as
|
||||
absoulte paths starting from the evennia main directory.
|
||||
"""
|
||||
pathsplit = python_path.strip().split('.')
|
||||
if not pathsplit:
|
||||
|
|
@ -161,14 +161,15 @@ def pypath_to_realpath(python_path, file_ending='py'):
|
|||
path = settings.BASE_PATH
|
||||
for directory in pathsplit:
|
||||
path = os.path.join(path, directory)
|
||||
return "%s.%s" % (path, file_ending)
|
||||
if file_ending:
|
||||
return "%s%s" % (path, file_ending)
|
||||
return path
|
||||
|
||||
def dbref(dbref):
|
||||
"""
|
||||
Converts/checks if input is a valid dbref
|
||||
Valid forms of dbref (database reference number)
|
||||
are either a string '#N' or an integer N.
|
||||
Output is the integer part.
|
||||
Converts/checks if input is a valid dbref Valid forms of dbref
|
||||
(database reference number) are either a string '#N' or
|
||||
an integer N. Output is the integer part.
|
||||
"""
|
||||
if type(dbref) == str:
|
||||
dbref = dbref.lstrip('#')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue