Evennia now runs on its own Twisted webserver (no need for testserver or Apache if you don't want to). Evennia now also has an ajax long-polling web client running from Twisted. The web client requires no extra dependencies beyond jQuery which is included. The src/server structure has been r

cleaned up and rewritten to make it easier to add new protocols in the future - all new protocols need to inherit from server.session.Session, whi
ch implements a set of hooks that Evennia uses to communicate. The current web client protocol is functional but does not implement any of rcaskey
's suggestions as of yet - it uses a separate data object passed through msg() to communicate between the server and the various protocols. Also the client itself could probably need cleanup and 'prettification'. The fact that the system runs a hybrid of Django and Twisted, getting the best of both worlds should allow for many possibilities in the future. /Griatch
This commit is contained in:
Griatch 2010-12-07 02:34:59 +00:00
parent ecefbfac01
commit 251f94aa7a
118 changed files with 9049 additions and 593 deletions

View file

@ -72,7 +72,7 @@ class ANSIParser(object):
# MUX-style mappings %cr %cn etc
mux_ansi_map = [
self.mux_ansi_map = [
(r'%r', ANSITable.ansi["return"]),
(r'%t', ANSITable.ansi["tab"]),
(r'%b', ANSITable.ansi["space"]),
@ -102,7 +102,7 @@ class ANSIParser(object):
hilite = ANSITable.ansi['hilite']
normal = ANSITable.ansi['normal']
ext_ansi_map = [
self.ext_ansi_map = [
(r'{r', hilite + ANSITable.ansi['red']),
(r'{R', normal + ANSITable.ansi['red']),
(r'{g', hilite + ANSITable.ansi['green']),
@ -121,8 +121,8 @@ class ANSIParser(object):
(r'{X', normal + ANSITable.ansi['black']), #pure black
(r'{n', normal) #reset
]
self.ansi_map = mux_ansi_map + ext_ansi_map
self.ansi_map = self.mux_ansi_map + self.ext_ansi_map
# prepare regex matching
self.ansi_sub = [(re.compile(sub[0], re.DOTALL), sub[1])
@ -141,13 +141,15 @@ class ANSIParser(object):
if not string:
return ''
string = str(string)
for sub in self.ansi_sub:
for sub in self.ansi_sub:
# go through all available mappings and translate them
string = sub[0].sub(sub[1], string)
if strip_ansi:
# remove all ANSI escape codes
string = self.ansi_regex.sub("", string)
return string
ANSI_PARSER = ANSIParser()
@ -161,3 +163,5 @@ def parse_ansi(string, strip_ansi=False, parser=ANSI_PARSER):
"""
return parser.parse_ansi(string, strip_ansi=strip_ansi)