From 1799e9b650d9b847f9f2b136a1bdf255f109014a Mon Sep 17 00:00:00 2001 From: Kevin Dangoor Date: Mon, 28 Sep 2009 10:53:46 -0700 Subject: [PATCH] adding some initial hooks to the JavaScript --- .hgignore | 2 +- bespin/controllers.py | 4 ++++ jackconfig.js | 19 +++++++++++++++++++ pavement.py | 3 +-- 4 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 jackconfig.js diff --git a/.hgignore b/.hgignore index 0825a52..5011c9c 100644 --- a/.hgignore +++ b/.hgignore @@ -1,4 +1,4 @@ syntax: glob *.pyc - +narwhal diff --git a/bespin/controllers.py b/bespin/controllers.py index cf1c6b6..0db864d 100644 --- a/bespin/controllers.py +++ b/bespin/controllers.py @@ -33,6 +33,7 @@ from hashlib import sha256 from urlrelay import URLRelay, register from paste.auth import auth_tkt +from paste.proxy import Proxy import simplejson import tempfile from webob import Request, Response @@ -1174,6 +1175,9 @@ def make_app(): register("^/docs/code/", code_app) register("^/docs/", docs_app) + proxy_app = Proxy("http://localhost:8081/") + register("^/.js/", proxy_app) + for location, directory in c.static_map.items(): topop = 1 + location.count('/') more_static = pathpopper_middleware(static.Cling(directory), topop) diff --git a/jackconfig.js b/jackconfig.js new file mode 100644 index 0000000..ba0bdcb --- /dev/null +++ b/jackconfig.js @@ -0,0 +1,19 @@ +var server = require("narwhal/server"); +var sprintf = require("printf").sprintf; +var Jack = require("jack"); +var Path = require("file").Path; +var system = require("system"); + +exports.app = function(env) { + var page = sprintf("Hi ", env.script.require("hello")); + return { + status : 200, + headers : { "Content-Type" : "text/html", "Content-Length" : String(page.length) }, + body : [page] + }; +}; + +var options = {debug:true}; + +exports.app = Jack.ShowExceptions(server.App(exports.app, options)); + diff --git a/pavement.py b/pavement.py index b32c603..8733da2 100644 --- a/pavement.py +++ b/pavement.py @@ -90,8 +90,7 @@ def start(): config.set_profile('dev') - if options.server.try_build: - config.c.static_dir = (options.build_dir / "frontend").abspath() + config.c.static_dir = path(options.clientdir) / "src" / "html" if options.server.dburl: config.c.dburl = options.server.dburl