Update CHANGELOG, pep8 fixes
This commit is contained in:
parent
0b6d869902
commit
b6b07ccdb5
10 changed files with 290 additions and 264 deletions
24
CHANGELOG.md
24
CHANGELOG.md
|
|
@ -10,6 +10,30 @@
|
|||
- Add the Portal uptime to the `@time` command.
|
||||
- Make the `@link` command first make a local search before a global search.
|
||||
|
||||
### Typeclasses
|
||||
|
||||
- Add new methods on all typeclasses, useful specifically for viewing the object in the web/admin:
|
||||
+ `web_get_admin_url()`: Returns a path that, if followed, will display the object in the Admin backend.
|
||||
+ `web_get_create_url()`: Returns a path for a view allowing the creation of new instances of this object.
|
||||
+ `web_get_absolute_url()`: Django construct; returns a path that should display the object in a DetailView.
|
||||
+ `web_get_update_url()`: Returns a path that should display the object in an UpdateView.
|
||||
+ `web_get_delete_url()`: Returns a path that should display the object in a DeleteView.
|
||||
- All typeclasses has new helper class method `create`, which encompasses useful functionality
|
||||
that used to be embedded for example in the respective `@create` or `@connect` commands.
|
||||
- DefaultAccount now has new class methods implementing many things that used to be in unloggedin
|
||||
commands (these can now be customized on the class instead):
|
||||
+ `is_banned()`: Checks if a given username or IP is banned.
|
||||
+ `get_username_validators`: Return list of validators for username validation (see
|
||||
`settings.AUTH_USERNAME_VALIDATORS`)
|
||||
+ `authenticate`: Method to check given username/password.
|
||||
+ `normalize_username`: Normalizes names so you can't fake names with similar-looking Unicode
|
||||
chars.
|
||||
+ `validate_username`: Mechanism for validating a username.
|
||||
+ `validate_password`: Mechanism for validating a password.
|
||||
+ `set_password`: Apply password to account, using validation checks.
|
||||
|
||||
|
||||
|
||||
### Utils
|
||||
|
||||
- Added more unit tests.
|
||||
|
|
|
|||
|
|
@ -7,10 +7,8 @@ from unittest import TestCase
|
|||
from django.test import override_settings
|
||||
from evennia.accounts.accounts import AccountSessionHandler
|
||||
from evennia.accounts.accounts import DefaultAccount, DefaultGuest
|
||||
from evennia.server.session import Session
|
||||
from evennia.utils.test_resources import EvenniaTest
|
||||
from evennia.utils import create
|
||||
from evennia.utils.test_resources import EvenniaTest
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
|
|
|
|||
|
|
@ -2,17 +2,11 @@
|
|||
Commands that are available from the connect screen.
|
||||
"""
|
||||
import re
|
||||
import time
|
||||
import datetime
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.auth import authenticate
|
||||
from evennia.accounts.models import AccountDB
|
||||
from evennia.objects.models import ObjectDB
|
||||
from evennia.comms.models import ChannelDB
|
||||
from evennia.server.models import ServerConfig
|
||||
from evennia.server.sessionhandler import SESSIONS
|
||||
from evennia.server.throttle import Throttle
|
||||
|
||||
from evennia.utils import class_from_module, create, logger, utils, gametime
|
||||
from evennia.commands.cmdhandler import CMD_LOGINSTART
|
||||
|
|
@ -26,6 +20,7 @@ __all__ = ("CmdUnconnectedConnect", "CmdUnconnectedCreate",
|
|||
MULTISESSION_MODE = settings.MULTISESSION_MODE
|
||||
CONNECTION_SCREEN_MODULE = settings.CONNECTION_SCREEN_MODULE
|
||||
|
||||
|
||||
def create_guest_account(session):
|
||||
"""
|
||||
Creates a guest account/character for this session, if one is available.
|
||||
|
|
@ -53,6 +48,7 @@ def create_guest_account(session):
|
|||
session.msg("|R%s|n" % '\n'.join(errors))
|
||||
return enabled, None
|
||||
|
||||
|
||||
def create_normal_account(session, name, password):
|
||||
"""
|
||||
Creates an account with the given name and password.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
from evennia.utils.test_resources import EvenniaTest
|
||||
from evennia import DefaultObject, DefaultCharacter, DefaultRoom, DefaultExit
|
||||
|
||||
|
||||
class DefaultObjectTest(EvenniaTest):
|
||||
|
||||
ip = '212.216.139.14'
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ from collections import defaultdict, deque
|
|||
from evennia.utils import logger
|
||||
import time
|
||||
|
||||
|
||||
class Throttle(object):
|
||||
"""
|
||||
Keeps a running count of failed actions per IP address.
|
||||
|
|
@ -110,5 +111,3 @@ class Throttle(object):
|
|||
return False
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
|
|
@ -4,6 +4,7 @@ from django.utils.translation import gettext as _
|
|||
from evennia.accounts.models import AccountDB
|
||||
import re
|
||||
|
||||
|
||||
class EvenniaUsernameAvailabilityValidator:
|
||||
"""
|
||||
Checks to make sure a given username is not taken or otherwise reserved.
|
||||
|
|
@ -37,9 +38,12 @@ class EvenniaUsernameAvailabilityValidator:
|
|||
code='evennia_username_taken',
|
||||
)
|
||||
|
||||
|
||||
class EvenniaPasswordValidator:
|
||||
|
||||
def __init__(self, regex=r"^[\w. @+\-',]+$", policy="Password should contain a mix of letters, spaces, digits and @/./+/-/_/'/, only."):
|
||||
def __init__(self, regex=r"^[\w. @+\-',]+$",
|
||||
policy="Password should contain a mix of letters, "
|
||||
"spaces, digits and @/./+/-/_/'/, only."):
|
||||
"""
|
||||
Constructs a standard Django password validator.
|
||||
|
||||
|
|
@ -82,5 +86,6 @@ class EvenniaPasswordValidator:
|
|||
|
||||
"""
|
||||
return _(
|
||||
"%s From a terminal client, you can also use a phrase of multiple words if you enclose the password in double quotes." % self.policy
|
||||
"%s From a terminal client, you can also use a phrase of multiple words if "
|
||||
"you enclose the password in double quotes." % self.policy
|
||||
)
|
||||
|
|
@ -222,7 +222,8 @@ COMMAND_RATE_WARNING = "You entered commands too fast. Wait a moment and try aga
|
|||
# 0 or less.
|
||||
MAX_CHAR_LIMIT = 6000
|
||||
# The warning to echo back to users if they enter a very large string
|
||||
MAX_CHAR_LIMIT_WARNING = "You entered a string that was too long. Please break it up into multiple parts."
|
||||
MAX_CHAR_LIMIT_WARNING = ("You entered a string that was too long. "
|
||||
"Please break it up into multiple parts.")
|
||||
# If this is true, errors and tracebacks from the engine will be
|
||||
# echoed as text in-game as well as to the log. This can speed up
|
||||
# debugging. OBS: Showing full tracebacks to regular users could be a
|
||||
|
|
@ -410,12 +411,14 @@ CMDSET_CHARACTER = "commands.default_cmdsets.CharacterCmdSet"
|
|||
CMDSET_ACCOUNT = "commands.default_cmdsets.AccountCmdSet"
|
||||
# Location to search for cmdsets if full path not given
|
||||
CMDSET_PATHS = ["commands", "evennia", "contribs"]
|
||||
# Fallbacks for cmdset paths that fail to load. Note that if you change the path for your default cmdsets,
|
||||
# you will also need to copy CMDSET_FALLBACKS after your change in your settings file for it to detect the change.
|
||||
CMDSET_FALLBACKS = {CMDSET_CHARACTER: 'evennia.commands.default.cmdset_character.CharacterCmdSet',
|
||||
CMDSET_ACCOUNT: 'evennia.commands.default.cmdset_account.AccountCmdSet',
|
||||
CMDSET_SESSION: 'evennia.commands.default.cmdset_session.SessionCmdSet',
|
||||
CMDSET_UNLOGGEDIN: 'evennia.commands.default.cmdset_unloggedin.UnloggedinCmdSet'}
|
||||
# Fallbacks for cmdset paths that fail to load. Note that if you change the path for your
|
||||
# default cmdsets, you will also need to copy CMDSET_FALLBACKS after your change in your
|
||||
# settings file for it to detect the change.
|
||||
CMDSET_FALLBACKS = {
|
||||
CMDSET_CHARACTER: 'evennia.commands.default.cmdset_character.CharacterCmdSet',
|
||||
CMDSET_ACCOUNT: 'evennia.commands.default.cmdset_account.AccountCmdSet',
|
||||
CMDSET_SESSION: 'evennia.commands.default.cmdset_session.SessionCmdSet',
|
||||
CMDSET_UNLOGGEDIN: 'evennia.commands.default.cmdset_unloggedin.UnloggedinCmdSet'}
|
||||
# Parent class for all default commands. Changing this class will
|
||||
# modify all default commands, so do so carefully.
|
||||
COMMAND_DEFAULT_CLASS = "evennia.commands.default.muxcommand.MuxCommand"
|
||||
|
|
@ -830,7 +833,7 @@ TEST_RUNNER = 'evennia.server.tests.EvenniaTestSuiteRunner'
|
|||
# Django extesions are useful third-party tools that are not
|
||||
# always included in the default django distro.
|
||||
try:
|
||||
import django_extensions
|
||||
import django_extensions # noqa
|
||||
INSTALLED_APPS = INSTALLED_APPS + ('django_extensions',)
|
||||
except ImportError:
|
||||
# Django extensions are not installed in all distros.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue