Cleaned up the webclient and changed how it handles sessions and identifies with the server. Fixed some reported bugs caused by the changed layout of sessionhandler.

This commit is contained in:
Griatch 2010-12-11 13:37:26 +00:00
parent b1682f78c9
commit 0eb5d29560
16 changed files with 191 additions and 107 deletions

View file

@ -28,8 +28,10 @@ def reload_modules():
# We protect e.g. src/ from reload since reloading it in a running
# server can create unexpected results (and besides, non-evennia devs
# should never need to do that anyway). Updating src requires a server
# reboot.
# reboot. Modules in except_dirs are considered ok to reload despite being
# inside src/
protected_dirs = ('src.',)
except_dirs = ('src.commands.default.')
# flag 'dangerous' typeclasses (those which retain a memory
# reference, notably Scripts with a timer component) for
@ -43,8 +45,8 @@ def reload_modules():
unsafe_modules = list(set(unsafe_modules))
def safe_dir_to_reload(modpath):
"Check so modpath is not a subdir of a protected dir"
return not any(modpath.startswith(pdir) for pdir in protected_dirs)
"Check so modpath is not a subdir of a protected dir, and not an ok exception"
return not any(modpath.startswith(pdir) and not any(modpath.startswith(pdir) for pdir in except_dirs) for pdir in protected_dirs)
def safe_mod_to_reload(modpath):
"Check so modpath is not in an unsafe module"
return not any(mpath.startswith(modpath) for mpath in unsafe_modules)

View file

@ -37,7 +37,7 @@ class TextToHTMLparser(object):
normalcode = '\033[0m'
tabstop = 4
re_string = re.compile(r'(?P<htmlchars>[<&>])|(?P<space>^[ \t]+)|(?P<lineend>\r\n|\r|\n)|(?P<protocal>(^|\s)((http|ftp)://.*?))(\s|$)',
re_string = re.compile(r'(?P<htmlchars>[<&>])|(?P<space>^[ \t]+)|(?P<lineend>\r\n|\r|\n)|(?P<protocol>(^|\s)((http|ftp)://.*?))(\s|$)',
re.S|re.M|re.I)
def re_color(self, text):
@ -95,7 +95,7 @@ class TextToHTMLparser(object):
elif c['space'] == '\t':
return ' '*self.tabstop
else:
url = m.group('protocal')
url = m.group('protocol')
if url.startswith(' '):
prefix = ' '
url = url[1:]

View file

@ -320,12 +320,21 @@ def format_table(table, extra_space=1):
collumns must have the same number of rows (some positions may be
empty though).
The function formats the columns to be as wide as the wides member
The function formats the columns to be as wide as the widest member
of each column.
extra_space defines how much extra padding should minimum be left between
collumns.
first_row_ansi defines an evential colour string for the first row.
print the resulting list e.g. with
for ir, row in enumarate(ftable):
if ir == 0:
# make first row white
string += "\n{w" + ""join(row) + "{n"
else:
string += "\n" + "".join(row)
print string
"""
if not table: