review/web_ui.py @ 9539fb54320e webui

More infrastructure for the web interface.
author Steve Losh <steve@stevelosh.com>
date Tue, 13 Oct 2009 19:02:45 -0400
parents 96a4cc60e57d
children 22906da596df
"""The review extension's web UI."""

import sys, os

package_path = os.path.split(os.path.realpath(__file__))[0]
template_path = os.path.join(package_path, 'web_templates')
top_path = os.path.split(package_path)[0]
bundled_path = os.path.join(top_path, 'bundled')
webpy_path = os.path.join(bundled_path, 'webpy')

sys.path.insert(0, webpy_path)
import web


_repo = None
urls = (
    '/', 'index'
)
render = web.template.render(template_path)

class index:
    def GET(self):
        return render.index(_repo)
    

app = web.application(urls, globals())

def load_interface(repo):
    global _repo
    _repo = repo
    
    sys.argv = sys.argv[:1]    # Seriously, web.py?  This is such a hack.
    app.run()