diff --git a/apps/helpsys/models.py b/apps/helpsys/models.py index 5d88f76204..52e03ac44c 100644 --- a/apps/helpsys/models.py +++ b/apps/helpsys/models.py @@ -1,5 +1,9 @@ -import ansi +""" +Models for the help system. +""" from django.db import models + +from src import ansi from apps.helpsys.managers.helpentry import HelpEntryManager class HelpEntry(models.Model): diff --git a/apps/objects/models.py b/apps/objects/models.py index c907284056..92aeb45b4f 100755 --- a/apps/objects/models.py +++ b/apps/objects/models.py @@ -3,15 +3,16 @@ import re from django.db import models from django.contrib.auth.models import User, Group -import scripthandler -import defines_global -import ansi -import src.flags from apps.config.models import ConfigValue from apps.objects.util import object as util_object from apps.objects.managers.commchannel import CommChannelManager from apps.objects.managers.object import ObjectManager from apps.objects.managers.attribute import AttributeManager +from src import scripthandler +import defines_global +from src import ansi +# Import as the absolute path to avoid local variable clashes. +import src.flags class Attribute(models.Model): """ @@ -894,4 +895,4 @@ class CommChannelMessage(models.Model): list_display = ('channel', 'message') import functions_general -import session_mgr +from src import session_mgr diff --git a/functions_comsys.py b/functions_comsys.py index 97e2770a4b..757adcbd8d 100644 --- a/functions_comsys.py +++ b/functions_comsys.py @@ -1,13 +1,14 @@ """ Comsys functions. """ -import time, datetime +import time +import datetime from django.utils import simplejson from apps.objects.models import CommChannel, CommChannelMessage -import session_mgr -import ansi +from src import session_mgr +from src import ansi def plr_get_cdict(session): """ diff --git a/functions_general.py b/functions_general.py index a07fa73b7c..70e0a443bd 100644 --- a/functions_general.py +++ b/functions_general.py @@ -3,7 +3,7 @@ General functions that don't fit neatly under any given category. """ import os import textwrap -import session_mgr +from src import session_mgr def wildcard_to_regexp(instring): """ diff --git a/settings.py.dist b/settings.py.dist index 487f195a03..3e608642fb 100755 --- a/settings.py.dist +++ b/settings.py.dist @@ -28,8 +28,8 @@ BASE_PATH = '/home/evennia/evennia' MEDIA_ROOT = '%s/media' % (BASE_PATH) # Absolute path to the directory that has the script tree in it. (no trailing slash) -# Example: "/home/evennia/scripts" -SCRIPT_ROOT = '%s/scripts' % (BASE_PATH) +# Example: "/home/evennia/src/scripts" +SCRIPT_ROOT = '%s/src/scripts' % (BASE_PATH) # 'postgresql', 'mysql', 'mysql_old', 'sqlite3' or 'ado_mssql'. DATABASE_ENGINE = 'sqlite3' diff --git a/ansi.py b/src/ansi.py similarity index 100% rename from ansi.py rename to src/ansi.py diff --git a/cmdhandler.py b/src/cmdhandler.py similarity index 100% rename from cmdhandler.py rename to src/cmdhandler.py diff --git a/cmdtable.py b/src/cmdtable.py similarity index 99% rename from cmdtable.py rename to src/cmdtable.py index f85e68cf1d..7a1be381bf 100644 --- a/cmdtable.py +++ b/src/cmdtable.py @@ -1,10 +1,3 @@ -import commands.general -import commands.privileged -import commands.comsys -import commands.unloggedin -import commands.info -import commands.objmanip - """ Command Table Entries --------------------- @@ -16,6 +9,12 @@ stuff. If the command is open to all (or you want to implement your own privilege checking in the command function), use None in place of the permissions tuple. """ +import commands.general +import commands.privileged +import commands.comsys +import commands.unloggedin +import commands.info +import commands.objmanip # -- Unlogged-in Command Table -- # Command Name Command Function Privilege Tuple diff --git a/commands/__init__.py b/src/commands/__init__.py similarity index 100% rename from commands/__init__.py rename to src/commands/__init__.py diff --git a/commands/comsys.py b/src/commands/comsys.py similarity index 99% rename from commands/comsys.py rename to src/commands/comsys.py index 531417b86d..090daa09d7 100644 --- a/commands/comsys.py +++ b/src/commands/comsys.py @@ -9,7 +9,7 @@ from django.conf import settings import functions_general import functions_comsys import defines_global -import ansi +from src import ansi def cmd_addcom(cdat): """ diff --git a/commands/general.py b/src/commands/general.py similarity index 99% rename from commands/general.py rename to src/commands/general.py index c64e8240f6..75b608d58d 100644 --- a/commands/general.py +++ b/src/commands/general.py @@ -11,8 +11,8 @@ from apps.helpsys.models import HelpEntry from apps.objects.models import Object import functions_general import defines_global -import session_mgr -import ansi +from src import session_mgr +from src import ansi def cmd_password(cdat): """ diff --git a/commands/info.py b/src/commands/info.py similarity index 95% rename from commands/info.py rename to src/commands/info.py index 80e8ce7b35..d1914025f5 100644 --- a/commands/info.py +++ b/src/commands/info.py @@ -11,8 +11,10 @@ if not functions_general.host_os_is('nt'): # Don't import the resource module if the host OS is Windows. import resource +import django + from apps.objects.models import Object -import scheduler +from src import scheduler import defines_global def cmd_version(cdat): @@ -21,7 +23,8 @@ def cmd_version(cdat): """ session = cdat['session'] retval = "-"*50 +"\n\r" - retval += "Evennia %s\n\r" % (defines_global.EVENNIA_VERSION,) + retval += " Evennia %s\n\r" % (defines_global.EVENNIA_VERSION,) + retval += " Django %s\n\r" % (django.get_version()) retval += "-"*50 session.msg(retval) diff --git a/commands/objmanip.py b/src/commands/objmanip.py similarity index 99% rename from commands/objmanip.py rename to src/commands/objmanip.py index c29168e169..efdc7a4cd6 100644 --- a/commands/objmanip.py +++ b/src/commands/objmanip.py @@ -2,9 +2,10 @@ These commands typically are to do with building or modifying Objects. """ from apps.objects.models import Object +# We'll import this as the full path to avoid local variable clashes. import src.flags -import ansi -import session_mgr +from src import ansi +from src import session_mgr def cmd_teleport(cdat): """ diff --git a/commands/privileged.py b/src/commands/privileged.py similarity index 99% rename from commands/privileged.py rename to src/commands/privileged.py index babf092b76..a8aa4b66e0 100644 --- a/commands/privileged.py +++ b/src/commands/privileged.py @@ -1,7 +1,7 @@ from apps.objects.models import Object import defines_global import functions_general -import ansi +from src import ansi """ This file contains commands that require special permissions to use. These diff --git a/commands/unloggedin.py b/src/commands/unloggedin.py similarity index 100% rename from commands/unloggedin.py rename to src/commands/unloggedin.py diff --git a/events.py b/src/events.py similarity index 100% rename from events.py rename to src/events.py diff --git a/initial_setup.py b/src/initial_setup.py similarity index 100% rename from initial_setup.py rename to src/initial_setup.py diff --git a/scheduler.py b/src/scheduler.py similarity index 99% rename from scheduler.py rename to src/scheduler.py index 7a685ce10b..41bf152ca4 100644 --- a/scheduler.py +++ b/src/scheduler.py @@ -1,6 +1,6 @@ import time from twisted.internet import task -import events +from src import events """ This file contains the event scheduler system. diff --git a/scripthandler.py b/src/scripthandler.py similarity index 100% rename from scripthandler.py rename to src/scripthandler.py diff --git a/scripts/__init__.py b/src/scripts/__init__.py similarity index 100% rename from scripts/__init__.py rename to src/scripts/__init__.py diff --git a/scripts/basicobject.py b/src/scripts/basicobject.py similarity index 99% rename from scripts/basicobject.py rename to src/scripts/basicobject.py index 7cfcaa70ea..e78673be03 100644 --- a/scripts/basicobject.py +++ b/src/scripts/basicobject.py @@ -2,8 +2,7 @@ This will be the base object type/interface that all scripts are derived from by default. It will have the necessary outline for developers to sub-class and override. """ - -import ansi +from src import ansi class BasicObject: def __init__(self, source_obj): diff --git a/scripts/exit/__init__.py b/src/scripts/exit/__init__.py similarity index 100% rename from scripts/exit/__init__.py rename to src/scripts/exit/__init__.py diff --git a/scripts/npc/__init__.py b/src/scripts/npc/__init__.py similarity index 100% rename from scripts/npc/__init__.py rename to src/scripts/npc/__init__.py diff --git a/scripts/thing/__init__.py b/src/scripts/thing/__init__.py similarity index 100% rename from scripts/thing/__init__.py rename to src/scripts/thing/__init__.py diff --git a/server.py b/src/server.py similarity index 96% rename from server.py rename to src/server.py index cb2ef0dc17..b04a40a61c 100755 --- a/server.py +++ b/src/server.py @@ -10,13 +10,12 @@ from django.db import connection from django.conf import settings from apps.config.models import CommandAlias, ConfigValue -from session import SessionProtocol -import settings -import scheduler +from src.session import SessionProtocol +from src import scheduler import functions_general -import session_mgr -import cmdtable -import initial_setup +from src import session_mgr +from src import cmdtable +from src import initial_setup class EvenniaService(service.Service): diff --git a/session.py b/src/session.py similarity index 100% rename from session.py rename to src/session.py diff --git a/session_mgr.py b/src/session_mgr.py similarity index 100% rename from session_mgr.py rename to src/session_mgr.py diff --git a/startup.sh b/startup.sh index 8cd9e63313..92e7701e68 100755 --- a/startup.sh +++ b/startup.sh @@ -11,6 +11,6 @@ mv -f $BASE_PATH/logs/evennia.log $BASE_PATH/logs/evennia.logs.old ## mode instead of having to uncomment crap. ## Interactive mode. Good for development and debugging. -twistd -n --logfile=logs/evennia.log --python=server.py +twistd -n --logfile=logs/evennia.log --python=src/server.py ## Stand-alone mode. Good for running games. -#twistd --logfile=logs/evennia.log --python=server.py +#twistd --logfile=logs/evennia.log --python=src/server.py