Add code to show identity and session dump, with prettyfication

git-svn-id: svn://localhost/lasso-conform/trunk@36 2a3a78c3-912c-0410-af21-e1fb2d1df599
This commit is contained in:
bdauvergne 2010-10-08 12:53:43 +00:00
parent f587bd560b
commit dac7ba8821
3 changed files with 1527 additions and 3 deletions

28
data/web/css/prettify.css Normal file
View File

@ -0,0 +1,28 @@
/* Pretty printing styles. Used with prettify.js. */
/* Under Apache Licence, downloaded from http://code.google.com/p/google-code-prettify */
.str { color: #080; }
.kwd { color: #008; }
.com { color: #800; }
.typ { color: #606; }
.lit { color: #066; }
.pun { color: #660; }
.pln { color: #000; }
.tag { color: #008; }
.atn { color: #606; }
.atv { color: #080; }
.dec { color: #606; }
pre.prettyprint { padding: 2px; border: 1px solid #888; }
@media print {
.str { color: #060; }
.kwd { color: #006; font-weight: bold; }
.com { color: #600; font-style: italic; }
.typ { color: #404; font-weight: bold; }
.lit { color: #044; }
.pun { color: #440; }
.pln { color: #000; }
.tag { color: #006; font-weight: bold; }
.atn { color: #404; }
.atv { color: #060; }
}

1478
data/web/js/prettify.js Normal file

File diff suppressed because it is too large Load Diff

View File

@ -22,7 +22,15 @@ import qommon.ident
from users import User
from qommon.tokens import Token
import subprocess
xmlindent = "/usr/bin/xmlindent"
def xml_format(str):
if os.path.exists(xmlindent):
p=subprocess.Popen(args=[xmlindent], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
return p.communicate(str)[0]
return str
class CookieGetterDirectory(Directory):
_q_exports = ['', 'spintro']
@ -97,7 +105,9 @@ class RootDirectory(Directory):
'ident', 'register', 'info', 'encryption', 'replay_artifact']
def _q_index [html] (self):
template.html_top('Lasso Conformance SP')
get_response().add_css_include('../../css/prettify.css')
get_response().add_javascript([ str('../../js/prettify.js') ])
template.html_top('Lasso Conformance SP', onload = "prettyPrint()")
if get_request().user:
self.loggedin_page()
@ -247,6 +257,14 @@ class RootDirectory(Directory):
'<pre>'
get_session().name_identifier
'</pre>'
'<h1>Session dump</h1>'
'<pre class="prettyprint lang-xml">'
xml_format(get_session().lasso_session_dump)
'</pre>'
'<h1>Identity dump</h1>'
'<pre class="prettyprint lang-xml">'
xml_format(get_request().user.lasso_dump)
'</pre>'
'<div id="logged-in-options">'
form.render()
'</div>'
@ -444,8 +462,8 @@ class RootDirectory(Directory):
get_publisher().write_cfg()
def _q_lookup(self, component):
if component == 'themes':
dirname = os.path.join(get_publisher().data_dir, 'themes')
if component in ('css','js'):
dirname = os.path.join(get_publisher().data_dir, 'web', component)
return StaticDirectory(dirname, follow_symlinks = True)
if component == 'qo':
dirname = os.path.join(get_publisher().data_dir, 'qommon')