Ticket #67 (defect)
Opened 7 months ago
Last modified 7 months ago
AuthKit middleware not working in 2.4 (patched)
Status: new
| Reported by: | kumar.mcmillan@gmail.com | Assigned to: | somebody |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Component: | component1 | Version: | |
| Keywords: | Cc: | ||
Hi. It seems that I need to keep my Pylons app working in 2.4 for the near future. When I upgraded Pylons to 0.9.7 I needed the new AuthKit? but I ran into a problem getting the tests to pass in 2.4.
Specifically:
Traceback (most recent call last):
...
File "/Users/kumar/src/AuthKit/authkit/authenticate/__init__.py", line 582, in sample_app
authorize_request(environ, RemoteUser())
File "/Users/kumar/src/AuthKit/authkit/authorize/wsgi_adaptors.py", line 198, in authorize_request
_PermissionStartResponse
File "/Users/kumar/src/AuthKit/authkit/permissions.py", line 174, in check
raise NotAuthenticatedError('Not Authenticated')
TypeError: exceptions must be classes, instances, or strings (deprecated), not NotAuthenticatedError
This is because Exceptions were not new-style classes until 2.5. WebOb? has a workaround for this but a couple changes were needed to bring that support to AuthKit?. I am attaching a patch that does the following:
- When 2.4 is detected, raises NotAuthenticatedError().exception (a special attribute from webob)
- Included a custom version of paste.httpexceptions.HTTPExceptionHandler with AuthKit? that has a minor modification to which exception types are caught
- I fixed a few errors not relating to this: webob was sending the header "text/plain; charset=utf8" but AuthKit? tests were expecting "text/plain"
After the patch, AuthKit? tests run in both 2.4 and 2.5
Shoot me an email if you have questions: kumar.mcmillan@gmail.com and thanks for creating and maintaing AuthKit? -- we're using it for LDAP auth in Pylons and it works well.
Attachments
Change History
02/20/09 23:53:40: Modified by kumar.mcmillan@gmail.com
- attachment authkit-2.4-compat.patch added.
02/20/09 23:57:47: Modified by anonymous
fyi, patch is against r175

Patches AuthKit? middleware for Python 2.4 compatibility