diff --git a/lodgeit/controllers/pastes.py b/lodgeit/controllers/pastes.py index 01728d2..43212f8 100644 --- a/lodgeit/controllers/pastes.py +++ b/lodgeit/controllers/pastes.py @@ -180,4 +180,5 @@ class PasteController(object): """Show a captcha.""" return Captcha().get_response(set_cookie=True) + controller = PasteController diff --git a/lodgeit/database.py b/lodgeit/database.py index a098693..f4d9e6f 100644 --- a/lodgeit/database.py +++ b/lodgeit/database.py @@ -24,6 +24,7 @@ def session_factory(): options = {'autoflush': True, 'autocommit': False} return orm.create_session(application.engine, **options) + session = orm.scoped_session(session_factory, scopefunc=_local_manager.get_ident) @@ -55,4 +56,5 @@ def _make_module(): db.NoResultFound = orm.exc.NoResultFound return db + sys.modules['lodgeit.database.db'] = db = _make_module() diff --git a/lodgeit/lib/highlighting.py b/lodgeit/lib/highlighting.py index b27cc75..ff088bc 100644 --- a/lodgeit/lib/highlighting.py +++ b/lodgeit/lib/highlighting.py @@ -38,6 +38,7 @@ def _get_pygments_lexers(add_empty=True): r.append((lexer[1][0], _(lexer[0])),) return r + LANGUAGES = _get_pygments_lexers() #: Add LodgeIt's special language lexers #: Or at least ensure those exist. diff --git a/lodgeit/utils.py b/lodgeit/utils.py index 3d03f28..f4e0bde 100644 --- a/lodgeit/utils.py +++ b/lodgeit/utils.py @@ -43,6 +43,7 @@ def url_for(endpoint, external=False, **values): builder = local.ctx.url_adapter.build return builder(endpoint, values, force_external=external) + jinja_environment.globals['url_for'] = url_for diff --git a/manage.py b/manage.py index 05a774b..8541705 100755 --- a/manage.py +++ b/manage.py @@ -15,10 +15,12 @@ def run_app(app, path='/'): env = create_environ(path, SECRET_KEY) return run_wsgi_app(app, env) + action_runserver = script.make_runserver( lambda: make_app(dburi, SECRET_KEY, debug=True), use_reloader=True) + action_shell = script.make_shell( lambda: { 'app': make_app(dburi, SECRET_KEY, False, True), diff --git a/tests/utilities/runner.py b/tests/utilities/runner.py index 0857940..c1e04f8 100644 --- a/tests/utilities/runner.py +++ b/tests/utilities/runner.py @@ -21,4 +21,5 @@ def testcase(): return with_setup(setup, teardown)(f) return dec + testcase.__test__ = False