diff --git a/bin/evennia b/bin/evennia index 3dbada2663..700a5add96 100755 --- a/bin/evennia +++ b/bin/evennia @@ -433,14 +433,9 @@ def create_game_directory(dirname): create_settings_file() -def create_superuser(): - print "\nCreate a superuser below. The superuser is Player #1, the 'owner' account of the server.\n" - django.core.management.call_command("createsuperuser", interactive=True) - - def check_database(exit_on_error=False): """ - Check database exists and has a superuser + Check database exists """ # Check so a database exists and is accessible from django.db import connection @@ -454,14 +449,6 @@ def check_database(exit_on_error=False): print ERROR_DATABASE.format(traceback=e) sys.exit() return False - - # Try to get Player#1 - from evennia.players.models import PlayerDB - try: - PlayerDB.objects.get(id=1) - except PlayerDB.DoesNotExist: - # no superuser yet. We need to create it. - create_superuser() return True diff --git a/evennia/comms/migrations/0005_auto_20150118_1631.py b/evennia/comms/migrations/0005_auto_20150118_1631.py new file mode 100644 index 0000000000..e757ec73ac --- /dev/null +++ b/evennia/comms/migrations/0005_auto_20150118_1631.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + +def convert_defaults(apps, schema_editor): + ChannelDB = apps.get_model("comms", "ChannelDB") + for channel in ChannelDB.objects.filter(db_typeclass_path="src.comms.comms.Channel"): + channel.db_typeclass_path = "typeclasses.channels.Channel" + channel.save() + +class Migration(migrations.Migration): + + dependencies = [ + ('comms', '0004_defaultchannel'), + ] + + operations = [ + migrations.RunPython(convert_defaults), + ] diff --git a/evennia/objects/migrations/0004_auto_20150118_1622.py b/evennia/objects/migrations/0004_auto_20150118_1622.py new file mode 100644 index 0000000000..3cc4d8beeb --- /dev/null +++ b/evennia/objects/migrations/0004_auto_20150118_1622.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + +def convert_defaults(apps, schema_editor): + ObjectDB = apps.get_model("objects", "ObjectDB") + for obj in ObjectDB.objects.filter(db_typeclass_path="src.objects.objects.Object"): + obj.db_typeclass_path = "typeclasses.objects.Object" + obj.save() + +class Migration(migrations.Migration): + + dependencies = [ + ('objects', '0003_defaultcharacter_defaultexit_defaultobject_defaultroom'), + ] + + operations = [ + migrations.RunPython(convert_defaults), + ] diff --git a/evennia/players/migrations/0003_auto_20150118_1609.py b/evennia/players/migrations/0003_auto_20150118_1609.py new file mode 100644 index 0000000000..ce7d70af2f --- /dev/null +++ b/evennia/players/migrations/0003_auto_20150118_1609.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + +def convert_defaults(apps, schema_editor): + PlayerDB = apps.get_model("players", "PlayerDB") + for player in PlayerDB.objects.filter(db_typeclass_path="src.players.player.Player"): + player.db_typeclass_path = "typeclasses.players.Player" + player.save() + +class Migration(migrations.Migration): + + dependencies = [ + ('players', '0002_auto_20150109_0913'), + ] + + operations = [ + migrations.RunPython(convert_defaults), + ] diff --git a/evennia/scripts/migrations/0003_auto_20150118_1625.py b/evennia/scripts/migrations/0003_auto_20150118_1625.py new file mode 100644 index 0000000000..369671277f --- /dev/null +++ b/evennia/scripts/migrations/0003_auto_20150118_1625.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + +def convert_defaults(apps, schema_editor): + ScriptDB = apps.get_model("scripts", "ScriptDB") + for script in ScriptDB.objects.filter(db_typeclass_path="src.scripts.scripts.Script"): + script.db_typeclass_path = "typeclasses.scripts.Script" + script.save() + +class Migration(migrations.Migration): + + dependencies = [ + ('scripts', '0002_checksessions_donothing_script_scriptbase_store_validatechannelhandler_validateidmappercache_validat'), + ] + + operations = [ + migrations.RunPython(convert_defaults), + ] diff --git a/evennia/server/initial_setup.py b/evennia/server/initial_setup.py index f5fbb34889..98cd880fe7 100644 --- a/evennia/server/initial_setup.py +++ b/evennia/server/initial_setup.py @@ -20,20 +20,17 @@ def create_config_values(): ServerConfig.objects.conf("site_name", settings.SERVERNAME) ServerConfig.objects.conf("idle_timeout", settings.IDLE_TIMEOUT) - def get_god_player(): """ - Creates the god user. + Creates the god user and don't take no for an answer. """ - try: - god_player = PlayerDB.objects.get(id=1) - except PlayerDB.DoesNotExist: - txt = "\n\nNo superuser exists yet. The superuser is the 'owner'\n" \ - "account on the Evennia server. Create a new superuser using\n" \ - "the command\n\n" \ - " python manage.py createsuperuser\n\n" \ - "Follow the prompts, then restart the server." - raise Exception(txt) + god_player = None + while not god_player: + try: + god_player = PlayerDB.objects.get(id=1) + except PlayerDB.DoesNotExist: + print "\nCreate a superuser below. The superuser is Player #1, the 'owner' account of the server.\n" + django.core.management.call_command("createsuperuser", interactive=True) return god_player