Cleaned and updated the i18n strings for various server-core system. Removed i18n for all strings that are only visible on stdout or in logs. Still missing i18n on certain specific things such as model field help and attribute warnings. Updated Swedish translation to match.
This commit is contained in:
parent
80da420ee7
commit
4c849ec351
26 changed files with 918 additions and 1420 deletions
|
|
@ -124,8 +124,6 @@ SECRET_KEY = '%s'
|
||||||
# Test the import of the settings file
|
# Test the import of the settings file
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
try:
|
try:
|
||||||
# i18n
|
|
||||||
from django.utils.translation import ugettext as _
|
|
||||||
from game import settings
|
from game import settings
|
||||||
except Exception:
|
except Exception:
|
||||||
import traceback
|
import traceback
|
||||||
|
|
@ -157,11 +155,11 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
# checks if the settings file was created this run
|
# checks if the settings file was created this run
|
||||||
if _CREATED_SETTINGS:
|
if _CREATED_SETTINGS:
|
||||||
print _("""
|
print """
|
||||||
Edit your new settings.py file as needed, then run
|
Edit your new settings.py file as needed, then run
|
||||||
'python manage syncdb' and follow the prompts to
|
'python manage syncdb' and follow the prompts to
|
||||||
create the database and your superuser account.
|
create the database and your superuser account.
|
||||||
""")
|
"""
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
# run the standard django manager, if dependencies match
|
# run the standard django manager, if dependencies match
|
||||||
|
|
|
||||||
Binary file not shown.
File diff suppressed because it is too large
Load diff
|
|
@ -45,6 +45,8 @@ from src.commands.cmdset import CmdSet
|
||||||
from src.commands.cmdparser import at_multimatch_cmd
|
from src.commands.cmdparser import at_multimatch_cmd
|
||||||
from src.utils.utils import string_suggestions
|
from src.utils.utils import string_suggestions
|
||||||
|
|
||||||
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
__all__ = ("cmdhandler",)
|
__all__ = ("cmdhandler",)
|
||||||
|
|
||||||
# This decides which command parser is to be used.
|
# This decides which command parser is to be used.
|
||||||
|
|
@ -196,18 +198,18 @@ def cmdhandler(caller, raw_string, testing=False):
|
||||||
if syscmd:
|
if syscmd:
|
||||||
sysarg = raw_string
|
sysarg = raw_string
|
||||||
else:
|
else:
|
||||||
sysarg = "Command '%s' is not available." % raw_string
|
sysarg = _("Command '%s' is not available.") % raw_string
|
||||||
suggestions = string_suggestions(raw_string, cmdset.get_all_cmd_keys_and_aliases(caller), cutoff=0.7, maxnum=3)
|
suggestions = string_suggestions(raw_string, cmdset.get_all_cmd_keys_and_aliases(caller), cutoff=0.7, maxnum=3)
|
||||||
if suggestions:
|
if suggestions:
|
||||||
sysarg += " Maybe you meant %s?" % utils.list_to_string(suggestions, 'or', addquote=True)
|
sysarg += _(" Maybe you meant %s?") % utils.list_to_string(suggestions, _('or'), addquote=True)
|
||||||
else:
|
else:
|
||||||
sysarg += " Type \"help\" for help."
|
sysarg += _(" Type \"help\" for help.")
|
||||||
raise ExecSystemCommand(syscmd, sysarg)
|
raise ExecSystemCommand(syscmd, sysarg)
|
||||||
|
|
||||||
if len(matches) > 1:
|
if len(matches) > 1:
|
||||||
# We have a multiple-match
|
# We have a multiple-match
|
||||||
syscmd = yield cmdset.get(CMD_MULTIMATCH)
|
syscmd = yield cmdset.get(CMD_MULTIMATCH)
|
||||||
sysarg = "There where multiple matches."
|
sysarg = _("There where multiple matches.")
|
||||||
if syscmd:
|
if syscmd:
|
||||||
syscmd.matches = matches
|
syscmd.matches = matches
|
||||||
else:
|
else:
|
||||||
|
|
@ -301,19 +303,19 @@ def cmdhandler(caller, raw_string, testing=False):
|
||||||
string += "If logging out/in doesn't solve the problem, try to "
|
string += "If logging out/in doesn't solve the problem, try to "
|
||||||
string += "contact the server admin through some other means "
|
string += "contact the server admin through some other means "
|
||||||
string += "for assistance."
|
string += "for assistance."
|
||||||
caller.msg(string)
|
caller.msg(_(string))
|
||||||
logger.log_errmsg("No cmdsets found: %s" % caller)
|
logger.log_errmsg("No cmdsets found: %s" % caller)
|
||||||
|
|
||||||
except Exception:
|
except Exception:
|
||||||
# We should not end up here. If we do, it's a programming bug.
|
# We should not end up here. If we do, it's a programming bug.
|
||||||
string = "%s\nAbove traceback is from an untrapped error."
|
string = "%s\nAbove traceback is from an untrapped error."
|
||||||
string += " Please file a bug report."
|
string += " Please file a bug report."
|
||||||
logger.log_trace(string)
|
logger.log_trace(_(string))
|
||||||
caller.msg(string % format_exc())
|
caller.msg(string % format_exc())
|
||||||
|
|
||||||
except Exception:
|
except Exception:
|
||||||
# This catches exceptions in cmdhandler exceptions themselves
|
# This catches exceptions in cmdhandler exceptions themselves
|
||||||
string = "%s\nAbove traceback is from a Command handler bug."
|
string = "%s\nAbove traceback is from a Command handler bug."
|
||||||
string += " Please contact an admin and/or file a bug report."
|
string += " Please contact an admin and/or file a bug report."
|
||||||
logger.log_trace(string)
|
logger.log_trace(_(string))
|
||||||
caller.msg(string % format_exc())
|
caller.msg(string % format_exc())
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ return a CommandCandidates object.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from src.utils.logger import log_trace
|
from src.utils.logger import log_trace
|
||||||
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
def cmdparser(raw_string, cmdset, caller, match_index=None):
|
def cmdparser(raw_string, cmdset, caller, match_index=None):
|
||||||
"""
|
"""
|
||||||
|
|
@ -140,7 +141,7 @@ def at_search_result(msg_obj, ostring, results, global_search=False):
|
||||||
string = ""
|
string = ""
|
||||||
if not results:
|
if not results:
|
||||||
# no results.
|
# no results.
|
||||||
string = "Could not find '%s'." % ostring
|
string = _("Could not find '%s'." % ostring)
|
||||||
results = None
|
results = None
|
||||||
|
|
||||||
elif len(results) > 1:
|
elif len(results) > 1:
|
||||||
|
|
@ -152,11 +153,12 @@ def at_search_result(msg_obj, ostring, results, global_search=False):
|
||||||
|
|
||||||
string += "More than one match for '%s'" % ostring
|
string += "More than one match for '%s'" % ostring
|
||||||
string += " (please narrow target):"
|
string += " (please narrow target):"
|
||||||
|
string = _(string)
|
||||||
for num, result in enumerate(results):
|
for num, result in enumerate(results):
|
||||||
invtext = ""
|
invtext = ""
|
||||||
dbreftext = ""
|
dbreftext = ""
|
||||||
if hasattr(result, "location") and result.location == msg_obj:
|
if hasattr(result, _("location")) and result.location == msg_obj:
|
||||||
invtext = " (carried)"
|
invtext = _(" (carried)")
|
||||||
if show_dbref:
|
if show_dbref:
|
||||||
dbreftext = "(#%i)" % result.dbid
|
dbreftext = "(#%i)" % result.dbid
|
||||||
string += "\n %i-%s%s%s" % (num+1, result.name,
|
string += "\n %i-%s%s%s" % (num+1, result.name,
|
||||||
|
|
@ -235,11 +237,11 @@ def at_multimatch_cmd(caller, matches):
|
||||||
|
|
||||||
is_channel = hasattr(cmd, "is_channel") and cmd.is_channel
|
is_channel = hasattr(cmd, "is_channel") and cmd.is_channel
|
||||||
if is_channel:
|
if is_channel:
|
||||||
is_channel = " (channel)"
|
is_channel = _(" (channel)")
|
||||||
else:
|
else:
|
||||||
is_channel = ""
|
is_channel = ""
|
||||||
if cmd.is_exit and cmd.destination:
|
if cmd.is_exit and cmd.destination:
|
||||||
is_exit = " (exit to %s)" % cmd.destination
|
is_exit = _(" (exit to %s)") % cmd.destination
|
||||||
else:
|
else:
|
||||||
is_exit = ""
|
is_exit = ""
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ together to create interesting in-game effects.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import copy
|
import copy
|
||||||
|
from django.utils.translation import ugettext as _
|
||||||
from src.utils.utils import inherits_from, is_iter
|
from src.utils.utils import inherits_from, is_iter
|
||||||
__all__ = ("CmdSet",)
|
__all__ = ("CmdSet",)
|
||||||
|
|
||||||
|
|
@ -303,9 +304,9 @@ class CmdSet(object):
|
||||||
try:
|
try:
|
||||||
cmd = self._instantiate(cmd)
|
cmd = self._instantiate(cmd)
|
||||||
except RuntimeError, e:
|
except RuntimeError, e:
|
||||||
string = "Adding cmdset %s to %s lead to an infinite loop. When adding a cmdset to another, "
|
string = "Adding cmdset %(cmd)s to %(class)s lead to an infinite loop. When adding a cmdset to another, "
|
||||||
string += "make sure they are not themself cyclically added to the new cmdset somewhere in the chain."
|
string += "make sure they are not themself cyclically added to the new cmdset somewhere in the chain."
|
||||||
raise RuntimeError(string % (cmd, self.__class__))
|
raise RuntimeError(_(string) % {"cmd":cmd, "class":self.__class__})
|
||||||
cmds = cmd.commands
|
cmds = cmd.commands
|
||||||
elif is_iter(cmd):
|
elif is_iter(cmd):
|
||||||
cmds = [self._instantiate(c) for c in cmd]
|
cmds = [self._instantiate(c) for c in cmd]
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,8 @@ import traceback
|
||||||
from src.utils import logger, utils
|
from src.utils import logger, utils
|
||||||
from src.commands.cmdset import CmdSet
|
from src.commands.cmdset import CmdSet
|
||||||
from src.server.models import ServerConfig
|
from src.server.models import ServerConfig
|
||||||
|
|
||||||
|
from django.utils.translation import ugettext as _
|
||||||
__all__ = ("import_cmdset", "CmdSetHandler")
|
__all__ = ("import_cmdset", "CmdSetHandler")
|
||||||
|
|
||||||
_CACHED_CMDSETS = {}
|
_CACHED_CMDSETS = {}
|
||||||
|
|
@ -110,15 +112,15 @@ def import_cmdset(python_path, cmdsetobj, emit_to_obj=None, no_logging=False):
|
||||||
return cmdsetclass
|
return cmdsetclass
|
||||||
|
|
||||||
except ImportError:
|
except ImportError:
|
||||||
errstring = "Error loading cmdset: Couldn't import module '%s'."
|
errstring = _("Error loading cmdset: Couldn't import module '%s'.")
|
||||||
errstring = errstring % modulepath
|
errstring = errstring % modulepath
|
||||||
raise
|
raise
|
||||||
except KeyError:
|
except KeyError:
|
||||||
errstring = "Error in loading cmdset: No cmdset class '%s' in %s."
|
errstring = _("Error in loading cmdset: No cmdset class '%(classname)s' in %(modulepath)s.")
|
||||||
errstring = errstring % (classname, modulepath)
|
errstring = errstring % {"classname":classname, "modulepath":modulepath}
|
||||||
raise
|
raise
|
||||||
except Exception:
|
except Exception:
|
||||||
errstring = "Compile/Run error when loading cmdset '%s'. Error was logged."
|
errstring = _("Compile/Run error when loading cmdset '%s'. Error was logged.")
|
||||||
errstring = errstring % (python_path)
|
errstring = errstring % (python_path)
|
||||||
raise
|
raise
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|
@ -194,15 +196,17 @@ class CmdSetHandler(object):
|
||||||
mergetype = self.mergetype_stack[-1]
|
mergetype = self.mergetype_stack[-1]
|
||||||
if mergetype != self.current.mergetype:
|
if mergetype != self.current.mergetype:
|
||||||
merged_on = self.cmdset_stack[-2].key
|
merged_on = self.cmdset_stack[-2].key
|
||||||
mergetype = "custom %s on cmdset '%s'" % (mergetype, merged_on)
|
mergetype = _("custom %(mergetype)s on cmdset '%(merged_on)s'") % {"mergetype":mergetype, "merged_on":merged_on}
|
||||||
if mergelist:
|
if mergelist:
|
||||||
string += " <Merged %s (%s, prio %i)>: %s" % ("+".join(mergelist), mergetype, self.current.priority, self.current)
|
string += _(" <Merged %(mergelist)s (%(mergetype)s, prio %(prio)i)>: %(current)s") % \
|
||||||
|
{"mergelist": "+".join(mergelist), "mergetype":mergetype, "prio":self.current.priority, "current":self.current}
|
||||||
else:
|
else:
|
||||||
permstring = "non-perm"
|
permstring = "non-perm"
|
||||||
if self.current.permanent:
|
if self.current.permanent:
|
||||||
permstring = "perm"
|
permstring = "perm"
|
||||||
string += " <%s (%s, prio %i, %s)>: %s" % (self.current.key, mergetype, self.current.priority, permstring,
|
string += _(" <%(key)s (%(mergetype)s, prio %(prio)i, %(permstring)s)>: %(keylist)s") % \
|
||||||
", ".join(cmd.key for cmd in sorted(self.current, key=lambda o:o.key)))
|
{"key":self.current.key, "mergetype":mergetype, "prio":self.current.priority, "permstring":permstring,
|
||||||
|
"keylost":", ".join(cmd.key for cmd in sorted(self.current, key=lambda o:o.key))}
|
||||||
return string.strip()
|
return string.strip()
|
||||||
|
|
||||||
def _import_cmdset(self, cmdset_path, emit_to_obj=None):
|
def _import_cmdset(self, cmdset_path, emit_to_obj=None):
|
||||||
|
|
@ -274,7 +278,7 @@ class CmdSetHandler(object):
|
||||||
"""
|
"""
|
||||||
if callable(cmdset):
|
if callable(cmdset):
|
||||||
if not utils.inherits_from(cmdset, CmdSet):
|
if not utils.inherits_from(cmdset, CmdSet):
|
||||||
raise Exception("Only CmdSets can be added to the cmdsethandler!")
|
raise Exception(_("Only CmdSets can be added to the cmdsethandler!"))
|
||||||
cmdset = cmdset(self.obj)
|
cmdset = cmdset(self.obj)
|
||||||
elif isinstance(cmdset, basestring):
|
elif isinstance(cmdset, basestring):
|
||||||
# this is (maybe) a python path. Try to import from cache.
|
# this is (maybe) a python path. Try to import from cache.
|
||||||
|
|
@ -306,7 +310,7 @@ class CmdSetHandler(object):
|
||||||
"""
|
"""
|
||||||
if callable(cmdset):
|
if callable(cmdset):
|
||||||
if not utils.inherits_from(cmdset, CmdSet):
|
if not utils.inherits_from(cmdset, CmdSet):
|
||||||
raise Exception("Only CmdSets can be added to the cmdsethandler!")
|
raise Exception(_("Only CmdSets can be added to the cmdsethandler!"))
|
||||||
cmdset = cmdset(self.obj)
|
cmdset = cmdset(self.obj)
|
||||||
elif isinstance(cmdset, basestring):
|
elif isinstance(cmdset, basestring):
|
||||||
# this is (maybe) a python path. Try to import from cache.
|
# this is (maybe) a python path. Try to import from cache.
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,8 @@ from src.comms.imc2lib import imc2_packets as pck
|
||||||
from src.comms.imc2lib.imc2_trackers import IMC2MudList, IMC2ChanList
|
from src.comms.imc2lib.imc2_trackers import IMC2MudList, IMC2ChanList
|
||||||
from src.comms.imc2lib.imc2_listeners import handle_whois_reply
|
from src.comms.imc2lib.imc2_listeners import handle_whois_reply
|
||||||
|
|
||||||
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
# IMC2 network setup
|
# IMC2 network setup
|
||||||
IMC2_MUDNAME = settings.SERVERNAME
|
IMC2_MUDNAME = settings.SERVERNAME
|
||||||
IMC2_NETWORK = settings.IMC2_NETWORK
|
IMC2_NETWORK = settings.IMC2_NETWORK
|
||||||
|
|
@ -61,7 +63,7 @@ class Send_IsAlive(Script):
|
||||||
def at_script_creation(self):
|
def at_script_creation(self):
|
||||||
self.key = 'IMC2_Send_IsAlive'
|
self.key = 'IMC2_Send_IsAlive'
|
||||||
self.interval = 900
|
self.interval = 900
|
||||||
self.desc = "Send an IMC2 is-alive packet"
|
self.desc = _("Send an IMC2 is-alive packet")
|
||||||
self.persistent = True
|
self.persistent = True
|
||||||
def at_repeat(self):
|
def at_repeat(self):
|
||||||
IMC2_CLIENT.send_packet(pck.IMC2PacketIsAlive())
|
IMC2_CLIENT.send_packet(pck.IMC2PacketIsAlive())
|
||||||
|
|
@ -77,7 +79,7 @@ class Send_Keepalive_Request(Script):
|
||||||
def at_script_creation(self):
|
def at_script_creation(self):
|
||||||
self.key = "IMC2_Send_Keepalive_Request"
|
self.key = "IMC2_Send_Keepalive_Request"
|
||||||
self.interval = 3500
|
self.interval = 3500
|
||||||
self.desc = "Send an IMC2 keepalive-request packet"
|
self.desc = _("Send an IMC2 keepalive-request packet")
|
||||||
self.persistent = True
|
self.persistent = True
|
||||||
def at_repeat(self):
|
def at_repeat(self):
|
||||||
IMC2_CLIENT.channel.send_packet(pck.IMC2PacketKeepAliveRequest())
|
IMC2_CLIENT.channel.send_packet(pck.IMC2PacketKeepAliveRequest())
|
||||||
|
|
@ -94,7 +96,7 @@ class Prune_Inactive_Muds(Script):
|
||||||
def at_script_creation(self):
|
def at_script_creation(self):
|
||||||
self.key = "IMC2_Prune_Inactive_Muds"
|
self.key = "IMC2_Prune_Inactive_Muds"
|
||||||
self.interval = 1800
|
self.interval = 1800
|
||||||
self.desc = "Check IMC2 list for inactive games"
|
self.desc = _("Check IMC2 list for inactive games")
|
||||||
self.persistent = True
|
self.persistent = True
|
||||||
self.inactive_threshold = 3599
|
self.inactive_threshold = 3599
|
||||||
def at_repeat(self):
|
def at_repeat(self):
|
||||||
|
|
@ -115,7 +117,7 @@ class Sync_Server_Channel_List(Script):
|
||||||
def at_script_creation(self):
|
def at_script_creation(self):
|
||||||
self.key = "IMC2_Sync_Server_Channel_List"
|
self.key = "IMC2_Sync_Server_Channel_List"
|
||||||
self.interval = 24 * 3600 # once every day
|
self.interval = 24 * 3600 # once every day
|
||||||
self.desc = "Re-sync IMC2 network channel list"
|
self.desc = _("Re-sync IMC2 network channel list")
|
||||||
self.persistent = True
|
self.persistent = True
|
||||||
def at_repeat(self):
|
def at_repeat(self):
|
||||||
checked_networks = []
|
checked_networks = []
|
||||||
|
|
@ -199,7 +201,7 @@ class IMC2Protocol(telnet.StatefulTelnetProtocol):
|
||||||
autosetup_present = line_split[0] == 'autosetup'
|
autosetup_present = line_split[0] == 'autosetup'
|
||||||
|
|
||||||
if "reject" in line_split:
|
if "reject" in line_split:
|
||||||
auth_message = "IMC2 server rejected connection."
|
auth_message = _("IMC2 server rejected connection.")
|
||||||
logger.log_infomsg(auth_message)
|
logger.log_infomsg(auth_message)
|
||||||
msg_info(auth_message)
|
msg_info(auth_message)
|
||||||
return
|
return
|
||||||
|
|
@ -208,14 +210,14 @@ class IMC2Protocol(telnet.StatefulTelnetProtocol):
|
||||||
self.server_name = line_split[1]
|
self.server_name = line_split[1]
|
||||||
self.network_name = line_split[4]
|
self.network_name = line_split[4]
|
||||||
elif autosetup_present:
|
elif autosetup_present:
|
||||||
logger.log_infomsg("IMC2: Autosetup response found.")
|
logger.log_infomsg(_("IMC2: Autosetup response found."))
|
||||||
self.server_name = line_split[1]
|
self.server_name = line_split[1]
|
||||||
self.network_name = line_split[3]
|
self.network_name = line_split[3]
|
||||||
self.is_authenticated = True
|
self.is_authenticated = True
|
||||||
self.sequence = int(time())
|
self.sequence = int(time())
|
||||||
|
|
||||||
# Log to stdout and notify over MUDInfo.
|
# Log to stdout and notify over MUDInfo.
|
||||||
auth_message = "Successfully authenticated to the '%s' network." % self.factory.network
|
auth_message = _("Successfully authenticated to the '%s' network.") % self.factory.network
|
||||||
logger.log_infomsg('IMC2: %s' % auth_message)
|
logger.log_infomsg('IMC2: %s' % auth_message)
|
||||||
msg_info(auth_message)
|
msg_info(auth_message)
|
||||||
|
|
||||||
|
|
@ -255,8 +257,9 @@ class IMC2Protocol(telnet.StatefulTelnetProtocol):
|
||||||
"""
|
"""
|
||||||
Handle tells over IMC2 by formatting the text properly
|
Handle tells over IMC2 by formatting the text properly
|
||||||
"""
|
"""
|
||||||
return "{c%s@%s{n {wpages (over IMC):{n %s" % (packet.sender, packet.origin,
|
return _("{c%(sender)s@%(origin)s{n {wpages (over IMC):{n %(msg)s") % {"sender":packet.sender,
|
||||||
packet.optional_data.get('text', 'ERROR: No text provided.'))
|
"origin":packet.origin,
|
||||||
|
"msg":packet.optional_data.get('text', 'ERROR: No text provided.')}
|
||||||
|
|
||||||
def lineReceived(self, line):
|
def lineReceived(self, line):
|
||||||
"""
|
"""
|
||||||
|
|
@ -365,12 +368,12 @@ class IMC2Factory(protocol.ClientFactory):
|
||||||
self.server_pwd = server_pwd
|
self.server_pwd = server_pwd
|
||||||
|
|
||||||
def clientConnectionFailed(self, connector, reason):
|
def clientConnectionFailed(self, connector, reason):
|
||||||
message = 'Connection failed: %s' % reason.getErrorMessage()
|
message = _('Connection failed: %s') % reason.getErrorMessage()
|
||||||
msg_info(message)
|
msg_info(message)
|
||||||
logger.log_errmsg('IMC2: %s' % message)
|
logger.log_errmsg('IMC2: %s' % message)
|
||||||
|
|
||||||
def clientConnectionLost(self, connector, reason):
|
def clientConnectionLost(self, connector, reason):
|
||||||
message = 'Connection lost: %s' % reason.getErrorMessage()
|
message = _('Connection lost: %s') % reason.getErrorMessage()
|
||||||
msg_info(message)
|
msg_info(message)
|
||||||
logger.log_errmsg('IMC2: %s' % message)
|
logger.log_errmsg('IMC2: %s' % message)
|
||||||
|
|
||||||
|
|
@ -407,7 +410,7 @@ def create_connection(channel, imc2_channel):
|
||||||
if not type(channel) == Channel:
|
if not type(channel) == Channel:
|
||||||
new_channel = Channel.objects.filter(db_key=channel)
|
new_channel = Channel.objects.filter(db_key=channel)
|
||||||
if not new_channel:
|
if not new_channel:
|
||||||
logger.log_errmsg("Cannot attach IMC2<->Evennia: Evennia Channel '%s' not found" % channel)
|
logger.log_errmsg(_("Cannot attach IMC2<->Evennia: Evennia Channel '%s' not found") % channel)
|
||||||
return False
|
return False
|
||||||
channel = new_channel[0]
|
channel = new_channel[0]
|
||||||
key = build_connection_key(channel, imc2_channel)
|
key = build_connection_key(channel, imc2_channel)
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,8 @@ This module handles some of the -reply packets like whois-reply.
|
||||||
from src.objects.models import ObjectDB
|
from src.objects.models import ObjectDB
|
||||||
from src.comms.imc2lib import imc2_ansi
|
from src.comms.imc2lib import imc2_ansi
|
||||||
|
|
||||||
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
def handle_whois_reply(packet):
|
def handle_whois_reply(packet):
|
||||||
"""
|
"""
|
||||||
When the player sends an imcwhois <playername> request, the outgoing
|
When the player sends an imcwhois <playername> request, the outgoing
|
||||||
|
|
@ -15,7 +17,7 @@ def handle_whois_reply(packet):
|
||||||
try:
|
try:
|
||||||
pobject = ObjectDB.objects.get(id=packet.target)
|
pobject = ObjectDB.objects.get(id=packet.target)
|
||||||
response_text = imc2_ansi.parse_ansi(packet.optional_data.get('text', 'Unknown'))
|
response_text = imc2_ansi.parse_ansi(packet.optional_data.get('text', 'Unknown'))
|
||||||
string = 'Whois reply from %s: %s' % (packet.origin, response_text)
|
string = _('Whois reply from %(origin)s: %(msg)s') % {"origin":packet.origin, "msg":response_text}
|
||||||
pobject.msg(string.strip())
|
pobject.msg(string.strip())
|
||||||
except ObjectDB.DoesNotExist:
|
except ObjectDB.DoesNotExist:
|
||||||
# No match found for whois sender. Ignore it.
|
# No match found for whois sender. Ignore it.
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,8 @@ from src.comms.models import ExternalChannelConnection, Channel
|
||||||
from src.utils import logger, utils
|
from src.utils import logger, utils
|
||||||
from src.server.sessionhandler import SESSIONS
|
from src.server.sessionhandler import SESSIONS
|
||||||
|
|
||||||
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
INFOCHANNEL = Channel.objects.channel_search(settings.CHANNEL_MUDINFO[0])
|
INFOCHANNEL = Channel.objects.channel_search(settings.CHANNEL_MUDINFO[0])
|
||||||
IRC_CHANNELS = []
|
IRC_CHANNELS = []
|
||||||
|
|
||||||
|
|
@ -46,7 +48,7 @@ class IRC_Bot(irc.IRCClient):
|
||||||
#msg_info("Client connecting to %s.'" % (self.factory.channel))
|
#msg_info("Client connecting to %s.'" % (self.factory.channel))
|
||||||
|
|
||||||
def joined(self, channel):
|
def joined(self, channel):
|
||||||
msg = "joined %s." % self.factory.pretty_key
|
msg = _("joined %s.") % self.factory.pretty_key
|
||||||
msg_info(msg)
|
msg_info(msg)
|
||||||
logger.log_infomsg(msg)
|
logger.log_infomsg(msg)
|
||||||
|
|
||||||
|
|
@ -61,7 +63,7 @@ class IRC_Bot(irc.IRCClient):
|
||||||
if user:
|
if user:
|
||||||
user.strip()
|
user.strip()
|
||||||
else:
|
else:
|
||||||
user = "Unknown"
|
user = _("Unknown")
|
||||||
msg = "[%s] %s@%s: %s" % (self.factory.evennia_channel, user, irc_channel, msg.strip())
|
msg = "[%s] %s@%s: %s" % (self.factory.evennia_channel, user, irc_channel, msg.strip())
|
||||||
#logger.log_infomsg("<IRC: " + msg)
|
#logger.log_infomsg("<IRC: " + msg)
|
||||||
for conn in conns:
|
for conn in conns:
|
||||||
|
|
@ -92,12 +94,12 @@ class IRCbotFactory(protocol.ClientFactory):
|
||||||
def clientConnectionLost(self, connector, reason):
|
def clientConnectionLost(self, connector, reason):
|
||||||
from twisted.internet.error import ConnectionDone
|
from twisted.internet.error import ConnectionDone
|
||||||
if type(reason.type) == type(ConnectionDone):
|
if type(reason.type) == type(ConnectionDone):
|
||||||
msg_info("Connection closed.")
|
msg_info(_("Connection closed."))
|
||||||
else:
|
else:
|
||||||
msg_info("Lost connection %s. Reason: '%s'. Reconnecting." % (self.pretty_key, reason))
|
msg_info(_("Lost connection %(key)s. Reason: '%(reason)s'. Reconnecting.") % {"key":self.pretty_key, "reason":reason})
|
||||||
connector.connect()
|
connector.connect()
|
||||||
def clientConnectionFailed(self, connector, reason):
|
def clientConnectionFailed(self, connector, reason):
|
||||||
msg = "Could not connect %s Reason: '%s'" % (self.pretty_key, reason)
|
msg = _("Could not connect %(key)s Reason: '%(reason)s'") % {"key":self.pretty_key, "reason":reason}
|
||||||
msg_info(msg)
|
msg_info(msg)
|
||||||
logger.log_errmsg(msg)
|
logger.log_errmsg(msg)
|
||||||
|
|
||||||
|
|
@ -117,7 +119,7 @@ def create_connection(channel, irc_network, irc_port, irc_channel, irc_bot_nick)
|
||||||
if not type(channel) == Channel:
|
if not type(channel) == Channel:
|
||||||
new_channel = Channel.objects.filter(db_key=channel)
|
new_channel = Channel.objects.filter(db_key=channel)
|
||||||
if not new_channel:
|
if not new_channel:
|
||||||
logger.log_errmsg("Cannot attach IRC<->Evennia: Evennia Channel '%s' not found" % channel)
|
logger.log_errmsg(_("Cannot attach IRC<->Evennia: Evennia Channel '%s' not found") % channel)
|
||||||
return False
|
return False
|
||||||
channel = new_channel[0]
|
channel = new_channel[0]
|
||||||
key = build_connection_key(channel, irc_network, irc_port, irc_channel, irc_bot_nick)
|
key = build_connection_key(channel, irc_network, irc_port, irc_channel, irc_bot_nick)
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ if RSS_ENABLED:
|
||||||
try:
|
try:
|
||||||
import feedparser
|
import feedparser
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise ImportError("RSS requirs python-feedparser to be installed. Install or set RSS_ENABLED=False.")
|
raise ImportError("RSS requires python-feedparser to be installed. Install or set RSS_ENABLED=False.")
|
||||||
|
|
||||||
class RSSReader(object):
|
class RSSReader(object):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,10 @@ to any other identifier you can use.
|
||||||
import re, inspect
|
import re, inspect
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from src.utils import logger, utils
|
from src.utils import logger, utils
|
||||||
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
__all__ = ("LockHandler", )
|
__all__ = ("LockHandler", )
|
||||||
|
|
||||||
#
|
#
|
||||||
# Exception class
|
# Exception class
|
||||||
#
|
#
|
||||||
|
|
@ -215,7 +218,7 @@ class LockHandler(object):
|
||||||
funcname, rest = (part.strip().strip(')') for part in funcstring.split('(', 1))
|
funcname, rest = (part.strip().strip(')') for part in funcstring.split('(', 1))
|
||||||
func = _LOCKFUNCS.get(funcname, None)
|
func = _LOCKFUNCS.get(funcname, None)
|
||||||
if not callable(func):
|
if not callable(func):
|
||||||
elist.append("Lock: function '%s' is not available." % funcstring)
|
elist.append(_("Lock: function '%s' is not available.") % funcstring)
|
||||||
continue
|
continue
|
||||||
args = list(arg.strip() for arg in rest.split(',') if not '=' in arg)
|
args = list(arg.strip() for arg in rest.split(',') if not '=' in arg)
|
||||||
kwargs = dict([arg.split('=', 1) for arg in rest.split(',') if '=' in arg])
|
kwargs = dict([arg.split('=', 1) for arg in rest.split(',') if '=' in arg])
|
||||||
|
|
@ -228,12 +231,12 @@ class LockHandler(object):
|
||||||
evalstring = " ".join(_RE_OK.findall(evalstring))
|
evalstring = " ".join(_RE_OK.findall(evalstring))
|
||||||
eval(evalstring % tuple(True for func in funclist), {}, {})
|
eval(evalstring % tuple(True for func in funclist), {}, {})
|
||||||
except Exception:
|
except Exception:
|
||||||
elist.append("Lock: definition '%s' has syntax errors." % raw_lockstring)
|
elist.append(_("Lock: definition '%s' has syntax errors.") % raw_lockstring)
|
||||||
continue
|
continue
|
||||||
if access_type in locks:
|
if access_type in locks:
|
||||||
duplicates += 1
|
duplicates += 1
|
||||||
wlist.append("Lock: access type '%s' changed from '%s' to '%s' " % \
|
wlist.append(_("Lock: access type '%(access_type)s' changed from '%(source)s' to '%(goal)s' " % \
|
||||||
(access_type, locks[access_type][2], raw_lockstring))
|
{"access_type":access_type, "source":locks[access_type][2], "goal":raw_lockstring}))
|
||||||
locks[access_type] = (evalstring, tuple(lock_funcs), raw_lockstring)
|
locks[access_type] = (evalstring, tuple(lock_funcs), raw_lockstring)
|
||||||
if wlist and self.log_obj:
|
if wlist and self.log_obj:
|
||||||
# a warning text was set, it's not an error, so only report if log_obj is available.
|
# a warning text was set, it's not an error, so only report if log_obj is available.
|
||||||
|
|
@ -266,17 +269,17 @@ class LockHandler(object):
|
||||||
# sanity checks
|
# sanity checks
|
||||||
for lockdef in lockstring.split(';'):
|
for lockdef in lockstring.split(';'):
|
||||||
if not ':' in lockstring:
|
if not ':' in lockstring:
|
||||||
self._log_error("Lock: '%s' contains no colon (:)." % lockdef)
|
self._log_error(_("Lock: '%s' contains no colon (:).") % lockdef)
|
||||||
return False
|
return False
|
||||||
access_type, rhs = [part.strip() for part in lockdef.split(':', 1)]
|
access_type, rhs = [part.strip() for part in lockdef.split(':', 1)]
|
||||||
if not access_type:
|
if not access_type:
|
||||||
self._log_error("Lock: '%s' has no access_type (left-side of colon is empty)." % lockdef)
|
self._log_error(_("Lock: '%s' has no access_type (left-side of colon is empty).") % lockdef)
|
||||||
return False
|
return False
|
||||||
if rhs.count('(') != rhs.count(')'):
|
if rhs.count('(') != rhs.count(')'):
|
||||||
self._log_error("Lock: '%s' has mismatched parentheses." % lockdef)
|
self._log_error(_("Lock: '%s' has mismatched parentheses.") % lockdef)
|
||||||
return False
|
return False
|
||||||
if not _RE_FUNCS.findall(rhs):
|
if not _RE_FUNCS.findall(rhs):
|
||||||
self._log_error("Lock: '%s' has no valid lock functions." % lockdef)
|
self._log_error(_("Lock: '%s' has no valid lock functions.") % lockdef)
|
||||||
return False
|
return False
|
||||||
# get the lock string
|
# get the lock string
|
||||||
storage_lockstring = self.obj.lock_storage
|
storage_lockstring = self.obj.lock_storage
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,8 @@ from src.scripts.models import ScriptDB
|
||||||
from src.utils import create
|
from src.utils import create
|
||||||
from src.utils import logger
|
from src.utils import logger
|
||||||
|
|
||||||
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
class ScriptHandler(object):
|
class ScriptHandler(object):
|
||||||
"""
|
"""
|
||||||
Implements the handler. This sits on each game object.
|
Implements the handler. This sits on each game object.
|
||||||
|
|
@ -38,11 +40,8 @@ class ScriptHandler(object):
|
||||||
repeats = script.repeats
|
repeats = script.repeats
|
||||||
try: next_repeat = script.time_until_next_repeat()
|
try: next_repeat = script.time_until_next_repeat()
|
||||||
except: next_repeat = "?"
|
except: next_repeat = "?"
|
||||||
string += "\n '%s' (%s/%s, %s repeats): %s" % (script.key,
|
string += _("\n '%(key)s' (%(next_repeat)s/%(interval)s, %(repeats)s repeats): %(desc)s") % \
|
||||||
next_repeat,
|
{"key":script.key, "next_repeat":next_repeat, "interval":interval,"repeats":repeats,"desc":script.desc}
|
||||||
interval,
|
|
||||||
repeats,
|
|
||||||
script.desc)
|
|
||||||
return string.strip()
|
return string.strip()
|
||||||
|
|
||||||
def add(self, scriptclass, key=None, autostart=True):
|
def add(self, scriptclass, key=None, autostart=True):
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ from src.typeclasses.models import _ATTRIBUTE_CACHE
|
||||||
from src.scripts.models import ScriptDB
|
from src.scripts.models import ScriptDB
|
||||||
from src.comms import channelhandler
|
from src.comms import channelhandler
|
||||||
from src.utils import logger
|
from src.utils import logger
|
||||||
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
__all__ = ("Script", "DoNothing", "CheckSessions", "ValidateScripts", "ValidateChannelHandler", "ClearAttributeCache")
|
__all__ = ("Script", "DoNothing", "CheckSessions", "ValidateScripts", "ValidateChannelHandler", "ClearAttributeCache")
|
||||||
|
|
||||||
|
|
@ -66,7 +67,8 @@ class ScriptClass(TypeClass):
|
||||||
def _step_err_callback(self, e):
|
def _step_err_callback(self, e):
|
||||||
"callback for runner errors"
|
"callback for runner errors"
|
||||||
cname = self.__class__.__name__
|
cname = self.__class__.__name__
|
||||||
estring = "Script %s(#%i) of type '%s': at_repeat() error '%s'." % (self.key, self.dbid, cname, e.getErrorMessage())
|
estring = _("Script %(key)s(#%(dbid)i) of type '%(cname)s': at_repeat() error '%(err)s'.") % \
|
||||||
|
{"key":self.key, "dbid":self.dbid, "cname":cname, "err":e.getErrorMessage()}
|
||||||
try:
|
try:
|
||||||
self.dbobj.db_obj.msg(estring)
|
self.dbobj.db_obj.msg(estring)
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|
@ -392,14 +394,14 @@ class DoNothing(Script):
|
||||||
def at_script_creation(self):
|
def at_script_creation(self):
|
||||||
"Setup the script"
|
"Setup the script"
|
||||||
self.key = "sys_do_nothing"
|
self.key = "sys_do_nothing"
|
||||||
self.desc = "This is an empty placeholder script."
|
self.desc = _("This is an empty placeholder script.")
|
||||||
|
|
||||||
class CheckSessions(Script):
|
class CheckSessions(Script):
|
||||||
"Check sessions regularly."
|
"Check sessions regularly."
|
||||||
def at_script_creation(self):
|
def at_script_creation(self):
|
||||||
"Setup the script"
|
"Setup the script"
|
||||||
self.key = "sys_session_check"
|
self.key = "sys_session_check"
|
||||||
self.desc = "Checks sessions so they are live."
|
self.desc = _("Checks sessions so they are live.")
|
||||||
self.interval = 60 # repeat every 60 seconds
|
self.interval = 60 # repeat every 60 seconds
|
||||||
self.persistent = True
|
self.persistent = True
|
||||||
|
|
||||||
|
|
@ -414,7 +416,7 @@ class ValidateScripts(Script):
|
||||||
def at_script_creation(self):
|
def at_script_creation(self):
|
||||||
"Setup the script"
|
"Setup the script"
|
||||||
self.key = "sys_scripts_validate"
|
self.key = "sys_scripts_validate"
|
||||||
self.desc = "Validates all scripts regularly."
|
self.desc = _("Validates all scripts regularly.")
|
||||||
self.interval = 3600 # validate every hour.
|
self.interval = 3600 # validate every hour.
|
||||||
self.persistent = True
|
self.persistent = True
|
||||||
|
|
||||||
|
|
@ -428,7 +430,7 @@ class ValidateChannelHandler(Script):
|
||||||
def at_script_creation(self):
|
def at_script_creation(self):
|
||||||
"Setup the script"
|
"Setup the script"
|
||||||
self.key = "sys_channels_validate"
|
self.key = "sys_channels_validate"
|
||||||
self.desc = "Updates the channel handler"
|
self.desc = _("Updates the channel handler")
|
||||||
self.interval = 3700 # validate a little later than ValidateScripts
|
self.interval = 3700 # validate a little later than ValidateScripts
|
||||||
self.persistent = True
|
self.persistent = True
|
||||||
|
|
||||||
|
|
@ -442,7 +444,7 @@ class ClearAttributeCache(Script):
|
||||||
def at_script_creation(self):
|
def at_script_creation(self):
|
||||||
"Setup the script"
|
"Setup the script"
|
||||||
self.key = "sys_cache_clear"
|
self.key = "sys_cache_clear"
|
||||||
self.desc = "Clears the Attribute Cache"
|
self.desc = _("Clears the Attribute Cache")
|
||||||
self.interval = 3600 * 2
|
self.interval = 3600 * 2
|
||||||
self.persistent = True
|
self.persistent = True
|
||||||
def at_repeat(self):
|
def at_repeat(self):
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ from src.server.models import ServerConfig
|
||||||
from src.help.models import HelpEntry
|
from src.help.models import HelpEntry
|
||||||
from src.utils import create
|
from src.utils import create
|
||||||
|
|
||||||
# i18n
|
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
def create_config_values():
|
def create_config_values():
|
||||||
|
|
@ -34,7 +33,7 @@ def create_objects():
|
||||||
Creates the #1 player and Limbo room.
|
Creates the #1 player and Limbo room.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
print _(" Creating objects (Player #1 and Limbo room) ...")
|
print " Creating objects (Player #1 and Limbo room) ..."
|
||||||
|
|
||||||
# Set the initial User's account object's username on the #1 object.
|
# Set the initial User's account object's username on the #1 object.
|
||||||
# This object is pure django and only holds name, email and password.
|
# This object is pure django and only holds name, email and password.
|
||||||
|
|
@ -89,7 +88,7 @@ def create_channels():
|
||||||
"""
|
"""
|
||||||
Creates some sensible default channels.
|
Creates some sensible default channels.
|
||||||
"""
|
"""
|
||||||
print _(" Creating default channels ...")
|
print " Creating default channels ..."
|
||||||
|
|
||||||
# public channel
|
# public channel
|
||||||
key, aliases, desc, locks = settings.CHANNEL_PUBLIC
|
key, aliases, desc, locks = settings.CHANNEL_PUBLIC
|
||||||
|
|
@ -112,12 +111,11 @@ def import_MUX_help_files():
|
||||||
"""
|
"""
|
||||||
Imports the MUX help files.
|
Imports the MUX help files.
|
||||||
"""
|
"""
|
||||||
print _(" Importing MUX help database (devel reference only) ...")
|
print " Importing MUX help database (devel reference only) ..."
|
||||||
management.call_command('loaddata', '../src/help/mux_help_db.json', verbosity=0)
|
management.call_command('loaddata', '../src/help/mux_help_db.json', verbosity=0)
|
||||||
# categorize the MUX help files into its own category.
|
# categorize the MUX help files into its own category.
|
||||||
default_category = "MUX"
|
default_category = "MUX"
|
||||||
print _(" Moving imported help db to help category '%(default)s'." \
|
print " Moving imported help db to help category '%(default)s'." % {'default': default_category}
|
||||||
% {'default': default_category})
|
|
||||||
HelpEntry.objects.all_to_category(default_category)
|
HelpEntry.objects.all_to_category(default_category)
|
||||||
|
|
||||||
def create_system_scripts():
|
def create_system_scripts():
|
||||||
|
|
@ -127,7 +125,7 @@ def create_system_scripts():
|
||||||
"""
|
"""
|
||||||
from src.scripts import scripts
|
from src.scripts import scripts
|
||||||
|
|
||||||
print _(" Creating and starting global scripts ...")
|
print " Creating and starting global scripts ..."
|
||||||
|
|
||||||
# check so that all sessions are alive.
|
# check so that all sessions are alive.
|
||||||
script1 = create.create_script(scripts.CheckSessions)
|
script1 = create.create_script(scripts.CheckSessions)
|
||||||
|
|
@ -138,7 +136,7 @@ def create_system_scripts():
|
||||||
# clear the attribute cache regularly
|
# clear the attribute cache regularly
|
||||||
script4 = create.create_script(scripts.ClearAttributeCache)
|
script4 = create.create_script(scripts.ClearAttributeCache)
|
||||||
if not script1 or not script2 or not script3 or not script4:
|
if not script1 or not script2 or not script3 or not script4:
|
||||||
print _(" Error creating system scripts.")
|
print " Error creating system scripts."
|
||||||
|
|
||||||
def start_game_time():
|
def start_game_time():
|
||||||
"""
|
"""
|
||||||
|
|
@ -147,7 +145,7 @@ def start_game_time():
|
||||||
the total run time of the server as well as its current uptime
|
the total run time of the server as well as its current uptime
|
||||||
(the uptime can also be found directly from the server though).
|
(the uptime can also be found directly from the server though).
|
||||||
"""
|
"""
|
||||||
print _(" Starting in-game time ...")
|
print " Starting in-game time ..."
|
||||||
from src.utils import gametime
|
from src.utils import gametime
|
||||||
gametime.init_gametime()
|
gametime.init_gametime()
|
||||||
|
|
||||||
|
|
@ -170,20 +168,20 @@ def create_admin_media_links():
|
||||||
dpath = os.path.join(django.__path__[0], 'contrib', 'admin', 'static', 'admin')
|
dpath = os.path.join(django.__path__[0], 'contrib', 'admin', 'static', 'admin')
|
||||||
apath = os.path.join(settings.ADMIN_MEDIA_ROOT)
|
apath = os.path.join(settings.ADMIN_MEDIA_ROOT)
|
||||||
if os.path.isdir(apath):
|
if os.path.isdir(apath):
|
||||||
print _(" ADMIN_MEDIA_ROOT already exists. Ignored.")
|
print " ADMIN_MEDIA_ROOT already exists. Ignored."
|
||||||
return
|
return
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
print _(" Admin-media files copied to ADMIN_MEDIA_ROOT (Windows mode).")
|
print " Admin-media files copied to ADMIN_MEDIA_ROOT (Windows mode)."
|
||||||
os.mkdir(apath)
|
os.mkdir(apath)
|
||||||
os.system('xcopy "%s" "%s" /e /q /c' % (dpath, apath))
|
os.system('xcopy "%s" "%s" /e /q /c' % (dpath, apath))
|
||||||
if os.name == 'posix':
|
if os.name == 'posix':
|
||||||
try:
|
try:
|
||||||
os.symlink(dpath, apath)
|
os.symlink(dpath, apath)
|
||||||
print _(" Admin-media symlinked to ADMIN_MEDIA_ROOT.")
|
print " Admin-media symlinked to ADMIN_MEDIA_ROOT."
|
||||||
except OSError, e:
|
except OSError, e:
|
||||||
print _(" There was an error symlinking Admin-media to ADMIN_MEDIA_ROOT:\n %s\n -> \n %s\n (%s)\n If you see issues, link manually." % (dpath, apath, e))
|
print " There was an error symlinking Admin-media to ADMIN_MEDIA_ROOT:\n %s\n -> \n %s\n (%s)\n If you see issues, link manually." % (dpath, apath, e)
|
||||||
else:
|
else:
|
||||||
print _(" Admin-media files should be copied manually to ADMIN_MEDIA_ROOT.")
|
print " Admin-media files should be copied manually to ADMIN_MEDIA_ROOT."
|
||||||
|
|
||||||
def at_initial_setup():
|
def at_initial_setup():
|
||||||
"""
|
"""
|
||||||
|
|
@ -199,7 +197,7 @@ def at_initial_setup():
|
||||||
mod = __import__(modname, fromlist=[None])
|
mod = __import__(modname, fromlist=[None])
|
||||||
except (ImportError, ValueError):
|
except (ImportError, ValueError):
|
||||||
return
|
return
|
||||||
print _(" Running at_initial_setup() hook.")
|
print " Running at_initial_setup() hook."
|
||||||
if mod.__dict__.get("at_initial_setup", None):
|
if mod.__dict__.get("at_initial_setup", None):
|
||||||
mod.at_initial_setup()
|
mod.at_initial_setup()
|
||||||
|
|
||||||
|
|
@ -211,7 +209,7 @@ def reset_server():
|
||||||
It also checks so the warm-reset mechanism works as it should.
|
It also checks so the warm-reset mechanism works as it should.
|
||||||
"""
|
"""
|
||||||
from src.server.sessionhandler import SESSIONS
|
from src.server.sessionhandler import SESSIONS
|
||||||
print _(" Initial setup complete. Resetting/reloading Server.")
|
print " Initial setup complete. Resetting/reloading Server."
|
||||||
SESSIONS.server.shutdown(mode='reset')
|
SESSIONS.server.shutdown(mode='reset')
|
||||||
|
|
||||||
def handle_setup(last_step):
|
def handle_setup(last_step):
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,6 @@ from src.utils.idmapper.models import SharedMemoryModel
|
||||||
from src.utils import logger, utils
|
from src.utils import logger, utils
|
||||||
from src.server.manager import ServerConfigManager
|
from src.server.manager import ServerConfigManager
|
||||||
|
|
||||||
# i18n
|
|
||||||
from django.utils.translation import ugettext as _
|
|
||||||
|
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# ServerConfig
|
# ServerConfig
|
||||||
|
|
@ -88,7 +85,7 @@ class ServerConfig(SharedMemoryModel):
|
||||||
"Setter. Allows for self.value = value"
|
"Setter. Allows for self.value = value"
|
||||||
if utils.has_parent('django.db.models.base.Model', value):
|
if utils.has_parent('django.db.models.base.Model', value):
|
||||||
# we have to protect against storing db objects.
|
# we have to protect against storing db objects.
|
||||||
logger.log_errmsg(_("ServerConfig cannot store db objects! (%s)" % value))
|
logger.log_errmsg("ServerConfig cannot store db objects! (%s)" % value)
|
||||||
return
|
return
|
||||||
self.db_value = pickle.dumps(value)
|
self.db_value = pickle.dumps(value)
|
||||||
self.save()
|
self.save()
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,6 @@ if os.name == 'nt':
|
||||||
# For Windows we need to handle pid files manually.
|
# For Windows we need to handle pid files manually.
|
||||||
PORTAL_PIDFILE = os.path.join(settings.GAME_DIR, 'portal.pid')
|
PORTAL_PIDFILE = os.path.join(settings.GAME_DIR, 'portal.pid')
|
||||||
|
|
||||||
# i18n
|
|
||||||
from django.utils.translation import ugettext as _
|
|
||||||
|
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
# Evennia Portal settings
|
# Evennia Portal settings
|
||||||
#------------------------------------------------------------
|
#------------------------------------------------------------
|
||||||
|
|
@ -103,7 +100,7 @@ class Portal(object):
|
||||||
"""
|
"""
|
||||||
Outputs server startup info to the terminal.
|
Outputs server startup info to the terminal.
|
||||||
"""
|
"""
|
||||||
print _(' %(servername)s Portal (%(version)s) started.') % {'servername': SERVERNAME, 'version': VERSION}
|
print ' %(servername)s Portal (%(version)s) started.' % {'servername': SERVERNAME, 'version': VERSION}
|
||||||
if AMP_ENABLED:
|
if AMP_ENABLED:
|
||||||
print " amp (Server): %s" % AMP_PORT
|
print " amp (Server): %s" % AMP_PORT
|
||||||
if TELNET_ENABLED:
|
if TELNET_ENABLED:
|
||||||
|
|
@ -135,7 +132,7 @@ class Portal(object):
|
||||||
if mode == None:
|
if mode == None:
|
||||||
return
|
return
|
||||||
f = open(PORTAL_RESTART, 'w')
|
f = open(PORTAL_RESTART, 'w')
|
||||||
print _("writing mode=%(mode)s to %(portal_restart)s") % {'mode': mode, 'portal_restart': PORTAL_RESTART}
|
print "writing mode=%(mode)s to %(portal_restart)s" % {'mode': mode, 'portal_restart': PORTAL_RESTART}
|
||||||
f.write(str(mode))
|
f.write(str(mode))
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -172,7 +172,7 @@ class Evennia(object):
|
||||||
if not last_initial_setup_step:
|
if not last_initial_setup_step:
|
||||||
# None is only returned if the config does not exist,
|
# None is only returned if the config does not exist,
|
||||||
# i.e. this is an empty DB that needs populating.
|
# i.e. this is an empty DB that needs populating.
|
||||||
print _(' Server started for the first time. Setting defaults.')
|
print ' Server started for the first time. Setting defaults.'
|
||||||
initial_setup.handle_setup(0)
|
initial_setup.handle_setup(0)
|
||||||
print '-'*50
|
print '-'*50
|
||||||
elif int(last_initial_setup_step) >= 0:
|
elif int(last_initial_setup_step) >= 0:
|
||||||
|
|
@ -180,8 +180,8 @@ class Evennia(object):
|
||||||
# modules and setup will resume from this step, retrying
|
# modules and setup will resume from this step, retrying
|
||||||
# the last failed module. When all are finished, the step
|
# the last failed module. When all are finished, the step
|
||||||
# is set to -1 to show it does not need to be run again.
|
# is set to -1 to show it does not need to be run again.
|
||||||
print _(' Resuming initial setup from step %(last)s.' % \
|
print ' Resuming initial setup from step %(last)s.' % \
|
||||||
{'last': last_initial_setup_step})
|
{'last': last_initial_setup_step}
|
||||||
initial_setup.handle_setup(int(last_initial_setup_step))
|
initial_setup.handle_setup(int(last_initial_setup_step))
|
||||||
print '-'*50
|
print '-'*50
|
||||||
|
|
||||||
|
|
@ -207,7 +207,7 @@ class Evennia(object):
|
||||||
"""
|
"""
|
||||||
Outputs server startup info to the terminal.
|
Outputs server startup info to the terminal.
|
||||||
"""
|
"""
|
||||||
print _(' %(servername)s Server (%(version)s) started.') % {'servername': SERVERNAME, 'version': VERSION}
|
print ' %(servername)s Server (%(version)s) started.' % {'servername': SERVERNAME, 'version': VERSION}
|
||||||
print ' amp (Portal): %s' % AMP_PORT
|
print ' amp (Portal): %s' % AMP_PORT
|
||||||
|
|
||||||
def set_restart_mode(self, mode=None):
|
def set_restart_mode(self, mode=None):
|
||||||
|
|
|
||||||
|
|
@ -28,9 +28,6 @@ from src.server import session
|
||||||
from src.players.models import PlayerDB
|
from src.players.models import PlayerDB
|
||||||
from src.utils import ansi, utils, logger
|
from src.utils import ansi, utils, logger
|
||||||
|
|
||||||
# i18n
|
|
||||||
from django.utils.translation import ugettext as _
|
|
||||||
|
|
||||||
ENCODINGS = settings.ENCODINGS
|
ENCODINGS = settings.ENCODINGS
|
||||||
|
|
||||||
CTRL_C = '\x03'
|
CTRL_C = '\x03'
|
||||||
|
|
@ -295,7 +292,7 @@ def getKeyPair(pubkeyfile, privkeyfile):
|
||||||
|
|
||||||
if not (os.path.exists(pubkeyfile) and os.path.exists(privkeyfile)):
|
if not (os.path.exists(pubkeyfile) and os.path.exists(privkeyfile)):
|
||||||
# No keypair exists. Generate a new RSA keypair
|
# No keypair exists. Generate a new RSA keypair
|
||||||
print _(" Generating SSH RSA keypair ..."),
|
print " Generating SSH RSA keypair ...",
|
||||||
from Crypto.PublicKey import RSA
|
from Crypto.PublicKey import RSA
|
||||||
|
|
||||||
KEY_LENGTH = 1024
|
KEY_LENGTH = 1024
|
||||||
|
|
@ -340,8 +337,8 @@ def makeFactory(configdict):
|
||||||
factory.publicKeys = {'ssh-rsa': publicKey}
|
factory.publicKeys = {'ssh-rsa': publicKey}
|
||||||
factory.privateKeys = {'ssh-rsa': privateKey}
|
factory.privateKeys = {'ssh-rsa': privateKey}
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
print _(" getKeyPair error: %(e)s\n WARNING: Evennia could not auto-generate SSH keypair. Using conch default keys instead.") % {'e': e}
|
print " getKeyPair error: %(e)s\n WARNING: Evennia could not auto-generate SSH keypair. Using conch default keys instead." % {'e': e}
|
||||||
print _(" If this error persists, create game/%(pub)s and game/%(priv)s yourself using third-party tools.") % {'pub': pubkeyfile, 'priv': privkeyfile}
|
print " If this error persists, create game/%(pub)s and game/%(priv)s yourself using third-party tools." % {'pub': pubkeyfile, 'priv': privkeyfile}
|
||||||
|
|
||||||
factory.services = factory.services.copy()
|
factory.services = factory.services.copy()
|
||||||
factory.services['ssh-userauth'] = ExtraInfoAuthServer
|
factory.services['ssh-userauth'] = ExtraInfoAuthServer
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ from twisted.internet import ssl as twisted_ssl
|
||||||
try:
|
try:
|
||||||
import OpenSSL
|
import OpenSSL
|
||||||
except ImportError:
|
except ImportError:
|
||||||
print _(" SSL_ENABLED requires PyOpenSSL.")
|
print " SSL_ENABLED requires PyOpenSSL."
|
||||||
sys.exit(5)
|
sys.exit(5)
|
||||||
|
|
||||||
from src.server.telnet import TelnetProtocol
|
from src.server.telnet import TelnetProtocol
|
||||||
|
|
@ -33,7 +33,7 @@ def verify_SSL_key_and_cert(keyfile, certfile):
|
||||||
from Crypto.PublicKey import RSA
|
from Crypto.PublicKey import RSA
|
||||||
from twisted.conch.ssh.keys import Key
|
from twisted.conch.ssh.keys import Key
|
||||||
|
|
||||||
print _(" Creating SSL key and certificate ... "),
|
print " Creating SSL key and certificate ... ",
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# create the RSA key and store it.
|
# create the RSA key and store it.
|
||||||
|
|
@ -42,8 +42,8 @@ def verify_SSL_key_and_cert(keyfile, certfile):
|
||||||
keyString = rsaKey.toString(type="OPENSSH")
|
keyString = rsaKey.toString(type="OPENSSH")
|
||||||
file(keyfile, 'w+b').write(keyString)
|
file(keyfile, 'w+b').write(keyString)
|
||||||
except Exception,e:
|
except Exception,e:
|
||||||
print _("rsaKey error: %(e)s\n WARNING: Evennia could not auto-generate SSL private key.") % {'e': e}
|
print "rsaKey error: %(e)s\n WARNING: Evennia could not auto-generate SSL private key." % {'e': e}
|
||||||
print _("If this error persists, create game/%(keyfile)s yourself using third-party tools.") % {'keyfile': keyfile}
|
print "If this error persists, create game/%(keyfile)s yourself using third-party tools." % {'keyfile': keyfile}
|
||||||
sys.exit(5)
|
sys.exit(5)
|
||||||
|
|
||||||
# try to create the certificate
|
# try to create the certificate
|
||||||
|
|
@ -55,12 +55,14 @@ def verify_SSL_key_and_cert(keyfile, certfile):
|
||||||
try:
|
try:
|
||||||
err = subprocess.call(exestring)#, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
err = subprocess.call(exestring)#, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||||
except OSError, e:
|
except OSError, e:
|
||||||
print " %s\n" % e
|
string = "\n".join([
|
||||||
print _(" Evennia's SSL context factory could not automatically create an SSL certificate game/%(cert)s.") % {'cert': certfile}
|
" %s\n" % e,
|
||||||
print _(" A private key 'ssl.key' was already created. Please create %(cert)s manually using the commands valid") % {'cert': certfile}
|
" Evennia's SSL context factory could not automatically create an SSL certificate game/%(cert)s." % {'cert': certfile},
|
||||||
print _(" for your operating system.")
|
" A private key 'ssl.key' was already created. Please create %(cert)s manually using the commands valid" % {'cert': certfile},
|
||||||
print _(" Example (linux, using the openssl program): ")
|
" for your operating system.",
|
||||||
print " %s" % exestring
|
" Example (linux, using the openssl program): ",
|
||||||
|
" %s" % exestring])
|
||||||
|
print string
|
||||||
sys.exit(5)
|
sys.exit(5)
|
||||||
print "done."
|
print "done."
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue