[Twisted-web] Guard and service
Remi Cool
mailinglists at smartology.nl
Tue Jun 6 09:26:57 CDT 2006
G'day,
I want to protect the root of my nevow Site with guard, but can't get it
to work.
My nevow Site is passed the service like in:
s = myService()
ms = service.MultiService()
internet.TCPServer(8000,
server.Site(resource.IResource(s))).setServiceParent(ms)
I used the nevow guarded example for the code and registered the
resource factory:
def createResource(service):
realm = MyRealm()
porta = portal.Portal(realm)
myChecker = checkers.InMemoryUsernamePasswordDatabaseDontUse()
myChecker.addUser("user","pass")
myChecker.addUser("fred", "flint")
porta.registerChecker(checkers.AllowAnonymousAccess(),
credentials.IAnonymous)
porta.registerChecker(myChecker)
res = guard.SessionWrapper(porta, mindFactory=Mind)
res.service = service
return res
Like so:
components.registerAdapter(createResource, ImyService, inevow.IResource)
When I browse to the root page (http://localhost:8000), FireFox gives me
an error:
> The page isn't redirecting properly
>
> Firefox has detected that the server is redirecting the request for
> this address in a way that will never complete.
>
> * This problem can sometimes be caused by disabling or refusing to
> accept cookies.
There are cookies, so that doesn't seem to be the problem.
How can I solve this problem?
More information about the Twisted-web
mailing list