On Tue, Feb 23, 2010 at 10:42 PM, Tom <email@example.com>
I got orbit to work for me tonight but I have some questions about it;
This is the code: http://gist.github.com/312913
It is identical to that of the orbit homepage except for line 27 where
I try to print some vars; it prints "" (21) .. why?
Three things. :-)
First, the web object is not a global variable, so if you want to use it in a function you call from your handler, you need to pass it along, so declare render_hello as render_hello(web) and then pass the web object when you call it.
Second, it is web.status and not web.status(). :-)
Third, the reason your web.status() is showing anything at all instead of raising an error is that you "htmlified" the render_hello function, so for any global it does not find it creates a function that will generate an HTML tag with the name of the global, so your web.status() is generating "<web class='status'></web>", which is obviously blank when rendered. Do and "view source" on your generated page and you will see it. :-)
On line 28 you can see the original line of code; I have no idea where
this comes from. What is p and what is p.hello? if I just return a
string there it works aswell :S
Htmlify turns p.hello("foo") into <p class="hello">foo</p>.
Also, I am serving this with lighttpd with mod_fastcgi and wsapi-fcgi.
I want to use mod_rewrite to make this file handle all request
(request dispatcher) but I am sure that I am doing it wrong atm;
url.rewrite-_once_ = (
"^.+$" => "dispatcher.lua"
Hmm, I don't quite remember my Lighttpd, but you seem to be throwing away your PATH_INFO with this pattern. You probably need to capture everything between ^ and $ with something like ^(.+)$ and then put something like $1 after dispatcher.lua.
If you are still learning I recommend using Xavante first (via the wsapi script), it is really painless. Then you can migrate to a "real" webserver later, I wrote some instructions for nginx a couple months ago:
I do see a request going for a certain URL but because the rewrite
happens before the handling the handler will only handle the request
"/dispatcher.lua" and I get an index page always ..