mirror of
https://github.com/evennia/evennia.git
synced 2026-04-03 22:47:16 +02:00
Making get_configvalue a bit more informative if a config value can't be found. Also actually populating the webcontext's game_name via get_configvalue.
This commit is contained in:
parent
f68e686fd9
commit
270db06820
2 changed files with 10 additions and 3 deletions
|
|
@ -1,10 +1,11 @@
|
|||
from django.conf import settings
|
||||
import gameconf
|
||||
|
||||
def general_context(request):
|
||||
"""
|
||||
Returns common Evennia-related context stuff.
|
||||
"""
|
||||
return {
|
||||
'game_name': "Test Game",
|
||||
'game_name': gameconf.get_configvalue('site_name'),
|
||||
'media_url': settings.MEDIA_URL,
|
||||
}
|
||||
|
|
|
|||
10
gameconf.py
10
gameconf.py
|
|
@ -1,5 +1,8 @@
|
|||
from apps.config.models import ConfigValue
|
||||
import os
|
||||
from traceback import format_exc
|
||||
|
||||
from apps.config.models import ConfigValue
|
||||
import functions_general
|
||||
"""
|
||||
Handle the setting/retrieving of server config directives.
|
||||
"""
|
||||
|
|
@ -16,7 +19,10 @@ def get_configvalue(configname):
|
|||
"""
|
||||
Retrieve a configuration value.
|
||||
"""
|
||||
return ConfigValue.objects.get(conf_key=configname).conf_value
|
||||
try:
|
||||
return ConfigValue.objects.get(conf_key=configname).conf_value
|
||||
except:
|
||||
functions_genera.log_errmsg("Unable to get config value for %s:\n%s" % (configname, (format_exc())))
|
||||
|
||||
def set_configvalue(configname, newvalue):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue