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:
Greg Taylor 2007-06-06 12:37:34 +00:00
parent f68e686fd9
commit 270db06820
2 changed files with 10 additions and 3 deletions

View file

@ -1,10 +1,11 @@
from django.conf import settings from django.conf import settings
import gameconf
def general_context(request): def general_context(request):
""" """
Returns common Evennia-related context stuff. Returns common Evennia-related context stuff.
""" """
return { return {
'game_name': "Test Game", 'game_name': gameconf.get_configvalue('site_name'),
'media_url': settings.MEDIA_URL, 'media_url': settings.MEDIA_URL,
} }

View file

@ -1,5 +1,8 @@
from apps.config.models import ConfigValue
import os import os
from traceback import format_exc
from apps.config.models import ConfigValue
import functions_general
""" """
Handle the setting/retrieving of server config directives. Handle the setting/retrieving of server config directives.
""" """
@ -16,7 +19,10 @@ def get_configvalue(configname):
""" """
Retrieve a configuration value. Retrieve a configuration value.
""" """
try:
return ConfigValue.objects.get(conf_key=configname).conf_value 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): def set_configvalue(configname, newvalue):
""" """