Removed 'with' statement; it's available in Python2.5, but one needs to use the future import to do that, so easiest to remove it. Resolves issue 230.

This commit is contained in:
Griatch 2012-05-04 10:03:41 +02:00
parent 7058b9f210
commit c49fbd7d99
4 changed files with 13 additions and 9 deletions

View file

@ -12,7 +12,7 @@ menu. Run the script with the -h flag to see usage information.
import os
import sys, signal
from optparse import OptionParser
from subprocess import Popen, call
from subprocess import Popen
# Set the Python path up so we can get to settings.py from here.
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
@ -22,6 +22,7 @@ if not os.path.exists('settings.py'):
# make sure we have a settings.py file.
print " No settings.py file found. launching manage.py ..."
# this triggers the settings file creation.
import game.manage
print """
@ -448,7 +449,6 @@ def main():
parser.add_option('-i', '--interactive', action='store_true', dest='interactive', default=False, help="Start given processes in interactive mode (log to stdout, don't start as a daemon).")
options, args = parser.parse_args()
inter = options.interactive
if not args:
mode = "menu"
@ -460,10 +460,10 @@ def main():
service = args[1]
if mode not in ['menu', 'start', 'reload', 'stop']:
print "mode should be none or one of 'menu', 'start', 'reload' or 'stop'."
print "mode should be none, 'menu', 'start', 'reload' or 'stop'."
sys.exit()
if service not in ['server', 'portal', 'all']:
print "service should be none or 'server', 'portal' or 'all'."
print "service should be none, 'server', 'portal' or 'all'."
sys.exit()
if mode == 'menu':

View file

@ -15,8 +15,9 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
# Get Evennia version
#------------------------------------------------------------
try:
with open(os.pardir + os.sep + 'VERSION') as f:
VERSION = "%s-r%s" % (f.read().strip(), os.popen("hg id -i").read().strip())
f = open(os.pardir + os.sep + 'VERSION', 'r''')
VERSION = "%s-r%s" % (f.read().strip(), os.popen("hg id -i").read().strip())
f.close()
except IOError:
VERSION = "Unknown version"

View file

@ -113,9 +113,12 @@ class AmpClientFactory(protocol.ReconnectingClientFactory):
"""
Called when the AMP connection to the MUD server is lost.
"""
if not hasattr(self, "server_restart_mode"):
if hasattr(self, "server_restart_mode"):
self.maxDelay = 1
else:
# Don't translate this; avoiding loading django on portal side.
self.portal.sessions.announce_all(" Portal lost connection to Server.")
self.maxDelay = 10
self.portal.sessions.announce_all(" ... Portal lost connection to Server.")
protocol.ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
def clientConnectionFailed(self, connector, reason):

View file

@ -4,8 +4,8 @@ General helper functions that don't fit neatly under any given category.
They provide some useful string and conversion methods that might
be of use when designing your own game.
"""
from inspect import ismodule
import os, sys, imp, types, math
import textwrap