Ugh, never mind, I found the problem: web:redirect(), not web.redirect .

Phu

On Dec 16, 2010, at 4:47 PM, Phu Nguyen wrote:

> Hi,
> 
> I'm trying to use Orbit for a project that requires authentication. I need to 
> supplement dispatch_get to get rid of some boiler plate, but I'm having 
> problems; I'm not very familiar with lua, can you help? Below is a sample of 
> what I'd like to do:
> 
> -- The error /usr/local/share/lua/5.1//orbit.lua:392: attempt to index local 
> 'self' (a string value)
> 
> -- The main package --
> 
> module( "fta", package.seeall, orbit.new )
> 
> fta:dispatch_static("/static/.*")
> 
> function fta:dispatch_get_authenticate(fcall, url)
>    fta:dispatch_get(
>        function(web)
>            local user = fta_authenticate.require(web)
> 
>            if ( user == nil ) then
>                return web.redirect("/account/login")
>            end
> 
>            return fcall( web, user)
>        end,
>    url)
> end
> 
> -- Then later in another package:
> 
> fta:dispatch_get_authenticate(
>    function(web, user)
>        return "Hello World"
>    end,
> "/dashboard")
> 
> --I also tried the fta.dispatch_get_authenticate to no avail.
> 
> Thanks,
> Phu
> 
> _______________________________________________
> Kepler-Project mailing list
> Kepler-Project@lists.luaforge.net
> http://lists.luaforge.net/cgi-bin/mailman/listinfo/kepler-project
> http://www.keplerproject.org/


_______________________________________________
Kepler-Project mailing list
Kepler-Project@lists.luaforge.net
http://lists.luaforge.net/cgi-bin/mailman/listinfo/kepler-project
http://www.keplerproject.org/

Reply via email to