"""
open/DurusWorks/proto/lib/ui/slash.qpy
"""
from datetime import datetime
from os.path import join
from pprint import pformat
from proto.ui.forms import FormsDirectory
from proto.ui.qwiki import QwikiDirectory
from qp.fill.directory import Directory, get_crumb_tree
from qp.fill.durus_directory import DurusDirectory
from qp.fill.html import href
from qp.fill.static import StaticFile, StaticDirectory
from qp.pub.common import get_publisher, get_path, get_site
from qp.pub.common import get_request, header, footer, page
from qp.pub.common import get_response
from qp.pub.common import get_session, get_user, redirect
from qp.pub.publish import DurusPublisher, RespondNow
class SitePublisher (DurusPublisher):
configuration = dict(
# Host and port of durus server.
durus_address=('localhost', 7002),
# Host and port of scgi server.
scgi_address=('localhost', 7003),
# Host and port of SSL service provided by Apache (or other).
https_address=('', 443),
# Location of database, log, and pid files.
var_directory='/www/var',
)
def display_exceptions(self):
return True
def ensure_signed_in(self):
self.ensure_signed_in_using_digest()
def header:xml(self, title, style=None, meta=None, **kwargs):
''
''
'
'
'' % (
get_request().get_script_name(), '/proto.js')
''
if meta:
meta
'%s' % title
if style:
'\n' % style
''
'\n' % get_publisher().get_agent_class()
'
'
items = sorted(get_request().__dict__.items())
for key, value in items:
'
%s
' % key
'
%s
' % pformat(value)
'
body
'
'
'
# get_request().read_body() would be useful if you wanted
# to parse the request body as xml, or json, or whatever.
repr(get_request().read_body())
'
'
'
'
def request:xml(self):
header('HTTP Request')
self.request_()
footer()
def format_sessions:xml():
session_items = sorted(get_publisher().get_sessions().items())
if not session_items:
'
No sessions.
'
else:
'
'
'
Saved Sessions
'
('
'
'
session key
'
'
owner
'
'
effective_user
'
'
authentication_time
'
'
remote_address
'
'
')
for id, session in session_items:
if get_session() is session:
'