mirror of https://github.com/dirtbags/netarch.git
refactor HtmlSession to expose CSS (startlog)
This commit is contained in:
parent
8b6893022c
commit
d429c3c3f9
|
@ -775,7 +775,14 @@ class Session(object):
|
||||||
class HtmlSession(Session):
|
class HtmlSession(Session):
|
||||||
def __init__(self, frame, packetClass=Packet, debug=True):
|
def __init__(self, frame, packetClass=Packet, debug=True):
|
||||||
Session.__init__(self, frame, packetClass)
|
Session.__init__(self, frame, packetClass)
|
||||||
|
self.sessfd = None
|
||||||
self.debug = debug
|
self.debug = debug
|
||||||
|
self.startlog()
|
||||||
|
|
||||||
|
def startlog(self, client="#a8a8a8", server="white"):
|
||||||
|
if self.sessfd is not None:
|
||||||
|
self.sessfd.close()
|
||||||
|
|
||||||
self.sessfd = self.open_out('session.html')
|
self.sessfd = self.open_out('session.html')
|
||||||
self.sessfd.write('''<?xml version="1.0" encoding="UTF-8"?>
|
self.sessfd.write('''<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE html
|
<!DOCTYPE html
|
||||||
|
@ -786,12 +793,12 @@ class HtmlSession(Session):
|
||||||
<title>%s</title>
|
<title>%s</title>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
.time { float: right; margin-left: 1em; font-size: 75%%; }
|
.time { float: right; margin-left: 1em; font-size: 75%%; }
|
||||||
.server { background-color: white; color: black; }
|
.server { background-color: %s; color: black; }
|
||||||
.client { background-color: #a8a8a8; color: black; }
|
.client { background-color: %s; color: black; }
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
''' % self.__class__.__name__)
|
''' % (self.__class__.__name__, server, client))
|
||||||
self.sessfd.write('<h1>%s</h1>\n' % self.__class__.__name__)
|
self.sessfd.write('<h1>%s</h1>\n' % self.__class__.__name__)
|
||||||
self.sessfd.write('<pre>')
|
self.sessfd.write('<pre>')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue