Move away from fixtures in favor of src/initial_setup.py, which makes it a little easier to change stuff like this. It also avoids over-writing stuff when syncdb is ran. This commit features database layout changes to ConnectScreen and CommChannel. It is recommended that you drop your database and re-sync. If this is not acceptable, talk to me about a migration plan. We will be investigating schema evolution down the road.

This commit is contained in:
Greg Taylor 2009-01-18 04:22:58 +00:00
parent c0ebbc3967
commit f6ee697e04
8 changed files with 119 additions and 38 deletions

View file

@ -1 +0,0 @@
[{"pk": 1, "model": "config.connectscreen", "fields": {"is_active": 1, "name": "Default", "connect_screen_text": "%ch%cb==================================================================%cn\r\n Welcome to Evennia! Please type one of the following to begin:\r\n\r\n If you have an existing account, connect to it by typing:\r\n %chconnect <email> <password2>%cn\r\n If you need to create an account, type (without the <>'s):\r\n %chcreate \"<username>\" <email> <password>%cn\r\n%ch%cb==================================================================%cn\r\n"}}, {"pk": 9, "model": "config.commandalias", "fields": {"user_input": "@desc", "equiv_command": "@describe"}}, {"pk": 3, "model": "config.commandalias", "fields": {"user_input": "@dest", "equiv_command": "@destroy"}}, {"pk": 4, "model": "config.commandalias", "fields": {"user_input": "@nuke", "equiv_command": "@destroy"}}, {"pk": 6, "model": "config.commandalias", "fields": {"user_input": "@tel", "equiv_command": "@teleport"}}, {"pk": 2, "model": "config.commandalias", "fields": {"user_input": "ex", "equiv_command": "examine"}}, {"pk": 7, "model": "config.commandalias", "fields": {"user_input": "i", "equiv_command": "inventory"}}, {"pk": 8, "model": "config.commandalias", "fields": {"user_input": "inv", "equiv_command": "inventory"}}, {"pk": 1, "model": "config.commandalias", "fields": {"user_input": "l", "equiv_command": "look"}}, {"pk": 5, "model": "config.commandalias", "fields": {"user_input": "sa", "equiv_command": "say"}}, {"pk": 1, "model": "config.configvalue", "fields": {"conf_value": "Evennia Test Site", "conf_key": "site_name"}}, {"pk": 2, "model": "config.configvalue", "fields": {"conf_value": "2", "conf_key": "player_dbnum_start"}}, {"pk": 3, "model": "config.configvalue", "fields": {"conf_value": "Credits", "conf_key": "money_name_plural"}}, {"pk": 4, "model": "config.configvalue", "fields": {"conf_value": "Credit", "conf_key": "money_name_singular"}}, {"pk": 5, "model": "config.configvalue", "fields": {"conf_value": "1", "conf_key": "game_firstrun"}}, {"pk": 6, "model": "config.configvalue", "fields": {"conf_value": "1800", "conf_key": "idle_timeout"}}, {"pk": 7, "model": "config.configvalue", "fields": {"conf_value": "2", "conf_key": "default_home"}}]

View file

@ -1,7 +1,6 @@
"""
Custom manager for ConfigValue objects.
"""
from traceback import format_exc
from django.db import models
from src import logger
@ -13,8 +12,9 @@ class ConfigValueManager(models.Manager):
try:
return self.get(conf_key__iexact=configname).conf_value
except self.model.DoesNotExist:
logger.log_errmsg("Unable to get config value for %s (does not exist):\n%s" % (
configname, (format_exc())))
logger.log_errmsg("Unable to get config value for %s (does not exist).\n" % (
configname))
raise
def set_configvalue(self, configname, newvalue):
"""
@ -29,4 +29,5 @@ class ConfigValueManager(models.Manager):
return newvalue
except self.model.DoesNotExist:
logger.log_errmsg("Unable to set config value for %s (does not exist):\n%s" % (
configname, (format_exc())))
configname))
raise

View file

@ -12,6 +12,7 @@ class ConnectScreenManager(models.Manager):
return self.filter(is_active=True).order_by('?')[0]
except IndexError:
new_screen = ConnectScreen(name='Default',
connect_screen_text='This is a placeholder connect screen. Remind your admin to edit it through the Admin interface.')
text='This is a placeholder connect screen. Remind your admin to edit it through the Admin interface.',
is_active=True)
new_screen.save()
return new_screen

View file

@ -44,7 +44,7 @@ class ConnectScreen(models.Model):
will cycle randomly.
"""
name = models.CharField(max_length=255, help_text="An optional name for this screen (for organizational purposes).", blank=True)
connect_screen_text = models.TextField(help_text="The text for the connect screen. Color codes and substitutions are evaluated.")
text = models.TextField(help_text="The text for the connect screen. Color codes and substitutions are evaluated.")
is_active = models.BooleanField(default=1, help_text="Only active connect screens are placed in the rotation")
objects = ConnectScreenManager()