libbe.command.html

class libbe.command.html.HTML(*args, **kwargs)

Serve or dump browsable HTML for the current repository

>>> import sys
>>> import libbe.bugdir
>>> bugdir = libbe.bugdir.SimpleBugDir(memory=False)
>>> io = libbe.command.StringInputOutput()
>>> io.stdout = sys.stdout
>>> ui = libbe.command.UserInterface(io=io)
>>> ui.storage_callbacks.set_storage(bugdir.storage)
>>> cmd = HTML(ui=ui)
>>> export_path = os.path.join(bugdir.storage.repo, 'html_export')
>>> ret = ui.run(cmd, {'output': export_path, 'export-html': True})
>>> os.path.exists(export_path)
True
>>> os.path.exists(os.path.join(export_path, 'index.html'))
True
>>> os.path.exists(os.path.join(export_path, 'index_inactive.html'))
True
>>> os.path.exists(os.path.join(export_path, bugdir.uuid))
True
>>> for bug in sorted(bugdir):
...     if os.path.exists(os.path.join(
...             export_path, bugdir.uuid, bug.uuid, 'index.html')):
...         print('got {}'.format(bug.uuid))
...     else:
...         print('missing {}'.format(bug.uuid))
got a
got b
>>> ui.cleanup()
>>> bugdir.cleanup()

Methods

cleanup()
complete([argument, fragment])
help(*args)
run([options, args])
usage()
name = 'html'
libbe.command.html.Html

alias of HTML

class libbe.command.html.ServerApp(bugdirs={}, template_dir=None, title='Site Title', header='Header', index_file='', min_id_length=-1, strip_email=False, generation_time=None, **kwargs)

WSGI server for a BE Storage instance over HTML.

Serve browsable HTML for public consumption. Currently everything is read-only.

Methods

bug(environ, start_response)
bug_dir(bug)
data_get_boolean(data, key[, default, source])
data_get_id(data[, key, default, source])
data_get_string(data, key[, default, source])
error(environ, start_response, error, message) Make it easy to call start_response for errors.
index(environ, start_response)
is_head(environ)
log_request(environ[, status, bytes])
ok_response(environ, start_response, content)
post_data(environ)
query_data(environ)
refresh()
style(environ, start_response)
bug(environ, start_response)
bug_dir(bug)
index(environ, start_response)
refresh()
server_version = 'BE-html-server/eb241d26'
style(environ, start_response)

This Page