Changeset 107
- Timestamp:
- 08/09/07 13:08:54
- Files:
-
- AuthKit/branches/0.4/authkit/authenticate/form.py (modified) (4 diffs)
- AuthKit/branches/0.4/authkit/authenticate/multi.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
AuthKit/branches/0.4/authkit/authenticate/form.py
r71 r107 4 4 detail in the AuthKit manual and should be used via the 5 5 ``authkit.authenticate.middleware`` function. 6 7 The option form.status can be set to "200 OK" if the Pylons error document 8 middleware is intercepting the 401 response and just showing the standard 401 9 error document. This will not happen in recent versions of Pylons (0.9.6) 10 because this middleware sets the environ['pylons.error_call'] key so that the 11 error documents middleware doesn't intercept the response. 6 12 """ 7 13 … … 11 17 get_authenticate_function, strip_base, RequireEnvironKey 12 18 from authkit.authenticate.multi import MultiHandler, status_checker 19 20 import logging 21 log = logging.getLogger('authkit.authenticate.form') 13 22 14 23 def template(): … … 36 45 app, 37 46 charset=None, 47 status="401 Unauthorized", 38 48 **p 39 49 ): 40 50 AuthFormHandler.__init__(self, app, **p) 51 self.status = status 41 52 if charset is None: 42 53 self.charset = '' … … 65 76 del environ['paste.parsed_formvars'] 66 77 return self.on_authorized(environ, start_response) 67 68 content = self.template() % construct_url(environ) 69 start_response("401 Unauthorized",[('Content-Type', 'text/html'+self.charset), 78 action = construct_url(environ) 79 log.debug("Form action is: %s", action) 80 content = self.template() % action 81 # @@@ Tell Pylons error documents middleware not to intercept the 82 # response 83 environ['pylons.error_call'] = 'authkit' 84 start_response(self.status,[('Content-Type', 'text/html'+self.charset), 70 85 ('Content-Length', str(len(content)))]) 71 86 return [content] AuthKit/branches/0.4/authkit/authenticate/multi.py
r86 r107 53 53 if checker(environ, status_[0], headers_ and headers_[0] or []): 54 54 log.debug( 55 "Mult Middleware self.checker check() returning %r",55 "MultiMiddleware self.checker check() returning %r", 56 56 binding 57 57 )
