AuthKit doesn’t work with Python 2.4 due to it has some Exceptions
declared not using the new class styles. The bug was fix partially in
AuthKit 0.4.5, thougth they say it's completely solved. Actually the
bug was solved in class RemoteUser (authkit/permissions.py), but
nothing was done in class ValidAuthKitUser (I used this class in my
applications).
I modified the class ValidAuthKitUser to this (watch out the
indentation!):
class ValidAuthKitUser(UserIn):
"""
Checks that the signed in user is one of the users specified when
setting up
the user management API.
"""
def __init__(self):
pass
def check(self, app, environ, start_response):
if 'authkit.users' not in environ:
raise no_authkit_users_in_environ
if not environ.get('REMOTE_USER'):
exc = NotAuthenticatedError('Not Authenticated')
if newstyle_exceptions:
raise exc
else:
raise exc.exception # see webob.exc for more details
#raise NotAuthenticatedError('Not Authenticated')
if not environ['authkit.users'].user_exists(environ
['REMOTE_USER']):
#raise NotAuthorizedError(
# 'You are not one of the users allowed to access this
resource.'
#)
exc = NotAuthorizedError(
'You are not one of the users allowed to access this
resource.'
)
if newstyle_exceptions:
raise exc
else:
raise exc.exception # ditto
return app(environ, start_response)
Am I wrong? Did I download an out-of-date version? Has anybody else
experienced the same kind of error?
gsandorx
On 23 Dec 2009, at 22:42, gsandorx wrote:
> AuthKit doesn’t work with Python 2.4 due to it has some Exceptions
> declared not using the new class styles. The bug was fix partially in
> AuthKit 0.4.5, thougth they say it's completely solved. Actually the
> bug was solved in class RemoteUser (authkit/permissions.py), but
> nothing was done in class ValidAuthKitUser (I used this class in my
> applications).
>
> I modified the class ValidAuthKitUser to this (watch out the
> indentation!):
> Am I wrong? Did I download an out-of-date version? Has anybody else
> experienced the same kind of error?
Don't use 2.4 m'self but your fix sounds reasonable. You might want to
drop an email to James Gardner at 3aims.com to get your fix integrated
with the development code, the last commit to the AuthKit tip was
about a months ago:
https://hg.3aims.com/public/AuthKit
HTH
Cheers,
Graham
http://www.linkedin.com/in/ghiggins
-----BEGIN PGP SIGNATURE-----
iEYEARECAAYFAks2FSQACgkQOsmLt1NhivzaZACfTAAvnSFTa9d7hgMGtu9q3zOo
J/0AoJA6UAU6H+7ex/LnHkC1aS5lWQ3liQCVAgUBSzYVJFnrWVZ7aXD1AQK6OQP/
bqQx24Nv8LRVJQU9+DTagVjUpfknMAGgHbCCn6JcbwaHIilRMVZHoBin6HbqSkLA
pWug2L4tlKvgqblj3i09drxOC48mPUdshWR1OuHlEjDK8SvRWZRFkrDaXHVgYZJQ
B4Wn9fO0MII1qmKQDCtCQqrQno5pH8FW9oIlpOEeUV4=
=9K4Q
-----END PGP SIGNATURE-----
Thanks,
Sandor
Yeah, RedHat Enterprise, our beloved museum...
> I used to compile python2.6 which is better, but having to install
> compilation tools on these servers is considered a security risk.
Have you considered preparing the distribution somewhere else, then
installing it? In simplest form:
- setup similar RHEL on some virtual machine
- install all compilation tools there
- build python2.6, install it in /opt or sth like that
- tar your /opt/python2.6, copy to the production, untar
(for even more polished solution consider preparing your own RPMs
instead of archive)
PS I feel that this thread would feel better if entitled:
AuthKit doesn't work with python 2.4 (patch)
or similarly. Too late to correct it here but worth remembering for the
future.