Colin Alston wrote:
class Page(object):
    def authenticateUser(self, request, passinfo):
user, password = request.getUser(), md5.md5(request.getPassword()).digest()

FWIW, the nevow version is about the same:

class MyPage(athena.LivePage or rend.Page):
    def renderHTTP(self, ctx):
        request = inevow.IRequest(ctx)

        username, password = request.getUser(), request.getPassword()
        if self.useAuth and (username, password) == (x, y):
            secure.info("rendering page because http auth is set")
            return rend.Page.renderHTTP(self, ctx)
        else:
request.setHeader('WWW-Authenticate', 'Basic realm="topsecret"')
            request.setResponseCode(http.UNAUTHORIZED)
            return "Authentication required."


_______________________________________________
Twisted-web mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web

Reply via email to