Is this the right approach to it?

    auth = web.ctx.env.get('HTTP_AUTHORIZATION')
    if auth is None:
      web.header('WWW-Authenticate', 'Basic realm="SEKRIT AREA"')
      web.ctx.status = '401 Unauthorized'
      return
    else:
      auth = re.sub('^Basic ', '', auth)
      credentials = base64.decodestring(auth).split(':')
      # sample check, normally would involve a database
      if not (credentials[0] == 'sheldon' and credentials[1] ==
'imagenius'):
        web.header('WWW-Authenticate', 'Basic realm="SEKRIT AREA"')
        web.ctx.status = '401 Unauthorized'
        return

Can I fit that into a loadhook and halt the subsequent request
handling conditionally? How?

--Jonas Galvez
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to