mirror of
https://github.com/evennia/evennia.git
synced 2026-03-30 04:27:16 +02:00
parent
fda51edea6
commit
f95dd3f2aa
1 changed files with 17 additions and 0 deletions
|
|
@ -2065,6 +2065,7 @@ class DefaultCharacter(DefaultObject):
|
|||
|
||||
# Set the supplied key as the name of the intended object
|
||||
kwargs["key"] = key
|
||||
key = cls._validate(key)
|
||||
|
||||
# Get home for character
|
||||
kwargs["home"] = ObjectDB.objects.get_id(kwargs.get("home", settings.DEFAULT_HOME))
|
||||
|
|
@ -2115,6 +2116,22 @@ class DefaultCharacter(DefaultObject):
|
|||
|
||||
return obj, errors
|
||||
|
||||
def _validate(self, key):
|
||||
"""
|
||||
Validate that character name is acceptable prior to creating. Note that this should be refactored
|
||||
to support i18n for non-latin scripts, but as we (currently) have no bug reports requesting better
|
||||
support of non-latin character sets, requiring character names to be latinified is an acceptable option.
|
||||
|
||||
Args:
|
||||
key (str) : The name of the character
|
||||
|
||||
Returns:
|
||||
key (str) : A valid name.
|
||||
"""
|
||||
from evennia.utils.utils import latinify
|
||||
key = latinify(key, default="X")
|
||||
return key
|
||||
|
||||
def basetype_setup(self):
|
||||
"""
|
||||
Setup character-specific security.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue