More fixes
This commit is contained in:
parent
aefe2b070f
commit
4cefba6e3b
5 changed files with 31 additions and 18 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
# Toc
|
# Toc
|
||||||
|
- [API root](api/evennia-api.rst)
|
||||||
- [./A voice operated elevator using events](./A-voice-operated-elevator-using-events)
|
- [./A voice operated elevator using events](./A-voice-operated-elevator-using-events)
|
||||||
- [./API refactoring](./API-refactoring)
|
- [./API refactoring](./API-refactoring)
|
||||||
- [./Accounts](./Accounts)
|
- [./Accounts](./Accounts)
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ import evennia
|
||||||
evennia._init()
|
evennia._init()
|
||||||
|
|
||||||
from django.db import connection
|
from django.db import connection
|
||||||
|
from django.db.utils import OperationalError
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
from evennia.accounts.models import AccountDB
|
from evennia.accounts.models import AccountDB
|
||||||
|
|
@ -205,7 +206,10 @@ class Evennia(object):
|
||||||
self.start_time = time.time()
|
self.start_time = time.time()
|
||||||
|
|
||||||
# initialize channelhandler
|
# initialize channelhandler
|
||||||
channelhandler.CHANNELHANDLER.update()
|
try:
|
||||||
|
channelhandler.CHANNELHANDLER.update()
|
||||||
|
except OperationalError:
|
||||||
|
print("channelhandler couldn't update - db not set up")
|
||||||
|
|
||||||
# wrap the SIGINT handler to make sure we empty the threadpool
|
# wrap the SIGINT handler to make sure we empty the threadpool
|
||||||
# even when we reload and we have long-running requests in queue.
|
# even when we reload and we have long-running requests in queue.
|
||||||
|
|
@ -616,7 +620,11 @@ class Evennia(object):
|
||||||
|
|
||||||
|
|
||||||
# Tell the system the server is starting up; some things are not available yet
|
# Tell the system the server is starting up; some things are not available yet
|
||||||
ServerConfig.objects.conf("server_starting_mode", True)
|
try:
|
||||||
|
ServerConfig.objects.conf("server_starting_mode", True)
|
||||||
|
except OperationalError:
|
||||||
|
print("Server server_starting_mode couldn't be set - database not set up.")
|
||||||
|
|
||||||
|
|
||||||
# twistd requires us to define the variable 'application' so it knows
|
# twistd requires us to define the variable 'application' so it knows
|
||||||
# what to execute from.
|
# what to execute from.
|
||||||
|
|
@ -728,4 +736,7 @@ for plugin_module in SERVER_SERVICES_PLUGIN_MODULES:
|
||||||
print(f"Could not load plugin module {plugin_module}")
|
print(f"Could not load plugin module {plugin_module}")
|
||||||
|
|
||||||
# clear server startup mode
|
# clear server startup mode
|
||||||
ServerConfig.objects.conf("server_starting_mode", delete=True)
|
try:
|
||||||
|
ServerConfig.objects.conf("server_starting_mode", delete=True)
|
||||||
|
except OperationalError:
|
||||||
|
print("Server server_starting_mode couldn't unset - db not set up.")
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
"""
|
"""
|
||||||
ANSI - Gives colour to text.
|
ANSI - Gives colour to text.
|
||||||
|
|
||||||
Use the codes defined in ANSIPARSER in your text
|
Use the codes defined in ANSIPARSER in your text to apply colour to text
|
||||||
to apply colour to text according to the ANSI standard.
|
according to the ANSI standard.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
|
|
@ -10,10 +10,9 @@ Examples:
|
||||||
"This is |rRed text|n and this is normal again."
|
"This is |rRed text|n and this is normal again."
|
||||||
```
|
```
|
||||||
|
|
||||||
Mostly you should not need to call `parse_ansi()` explicitly;
|
Mostly you should not need to call `parse_ansi()` explicitly; it is run by
|
||||||
it is run by Evennia just before returning data to/from the
|
Evennia just before returning data to/from the user. Depreciated example forms
|
||||||
user. Depreciated example forms are available by extending
|
are available by extending the ansi mapping.
|
||||||
the ansi mapping.
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
import functools
|
import functools
|
||||||
|
|
@ -81,11 +80,9 @@ _COLOR_NO_DEFAULT = settings.COLOR_NO_DEFAULT
|
||||||
|
|
||||||
class ANSIParser(object):
|
class ANSIParser(object):
|
||||||
"""
|
"""
|
||||||
A class that parses ANSI markup
|
A class that parses ANSI markup to ANSI command sequences.
|
||||||
to ANSI command sequences
|
|
||||||
|
|
||||||
We also allow to escape colour codes
|
We also allow to escape colour codes by prepending with an extra `|`.
|
||||||
by prepending with an extra |.
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -96,16 +96,16 @@ def create_object(
|
||||||
location itself or during unittests.
|
location itself or during unittests.
|
||||||
attributes (list): Tuples on the form (key, value) or (key, value, category),
|
attributes (list): Tuples on the form (key, value) or (key, value, category),
|
||||||
(key, value, lockstring) or (key, value, lockstring, default_access).
|
(key, value, lockstring) or (key, value, lockstring, default_access).
|
||||||
to set as Attributes on the new object.
|
to set as Attributes on the new object.
|
||||||
nattributes (list): Non-persistent tuples on the form (key, value). Note that
|
nattributes (list): Non-persistent tuples on the form (key, value). Note that
|
||||||
adding this rarely makes sense since this data will not survive a reload.
|
adding this rarely makes sense since this data will not survive a reload.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
object (Object): A newly created object of the given typeclass.
|
object (Object): A newly created object of the given typeclass.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
ObjectDB.DoesNotExist: If trying to create an Object with
|
ObjectDB.DoesNotExist: If trying to create an Object with
|
||||||
`location` or `home` that can't be found.
|
`location` or `home` that can't be found.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
global _ObjectDB
|
global _ObjectDB
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import time
|
||||||
from calendar import monthrange
|
from calendar import monthrange
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
|
from django.db.utils import OperationalError
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from evennia import DefaultScript
|
from evennia import DefaultScript
|
||||||
from evennia.server.models import ServerConfig
|
from evennia.server.models import ServerConfig
|
||||||
|
|
@ -23,7 +24,11 @@ IGNORE_DOWNTIMES = settings.TIME_IGNORE_DOWNTIMES
|
||||||
|
|
||||||
|
|
||||||
# Only set if gametime_reset was called at some point.
|
# Only set if gametime_reset was called at some point.
|
||||||
GAME_TIME_OFFSET = ServerConfig.objects.conf("gametime_offset", default=0)
|
try:
|
||||||
|
GAME_TIME_OFFSET = ServerConfig.objects.conf("gametime_offset", default=0)
|
||||||
|
except OperationalError:
|
||||||
|
print("Gametime offset could not load - db not set up.")
|
||||||
|
GAME_TIME_OFFSET = 0
|
||||||
|
|
||||||
# Common real-life time measure, in seconds.
|
# Common real-life time measure, in seconds.
|
||||||
# You should not change this.
|
# You should not change this.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue