Hello, François.
Thank you very much! I've just released repoze.what-quickstart 1.0.8 with this
feature.
Enjoy!
- Gustavo.
François said:
Hi there,
I'm was trying to use custom columns in my user table using TG2 (is_active
column for a user)
I decided to overload the SQLAlchemyAuthenticator to be able to check this
additional column value.
I passed my custom class instance to authenticators argument but the main
(SQLAlchemyAuthenticator) is always used and there is
no way to disable it.
I added a keyword argument named 'use_main_authenticator' witch - if
authenticators keyword is used - discard the main one and only used passed
instance.
Regards,
F.
Index: repoze/what/plugins/quickstart/__init__.py
===
--- repoze/what/plugins/quickstart/__init__.py (revision 9436)
+++ repoze/what/plugins/quickstart/__init__.py (working copy)
@@ -236,16 +236,23 @@
if permission_adapter:
permission_adapters = {'sql_auth': permission_adapter}
+use_main_authenticator = True
# Setting the repoze.who authenticators:
-sqlauth = SQLAlchemyAuthenticatorPlugin(user_class, dbsession)
-sqlauth.translations.update(plugin_translations['authenticator'])
if 'authenticators' not in who_args:
who_args['authenticators'] = []
-who_args['authenticators'].append(('sqlauth', sqlauth))
+else:
+if 'use_main_authenticator' in who_args and \
+ who_args['use_main_authenticator'] == False:
+use_main_authenticator = False
+if use_main_authenticator != False:
+sqlauth = SQLAlchemyAuthenticatorPlugin(user_class, dbsession)
+sqlauth.translations.update(plugin_translations['authenticator'])
+who_args['authenticators'].append(('sqlauth', sqlauth))
+
cookie = AuthTktCookiePlugin(cookie_secret, cookie_name,
- timeout=cookie_timeout,
- reissue_time=cookie_reissue_time)
+ timeout=cookie_timeout,
+ reissue_time=cookie_reissue_time)
# Setting the repoze.who identifiers
if 'identifiers' not in who_args:
--
Gustavo Narea xri://=Gustavo.
| Tech blog: =Gustavo/(+blog)/tech ~ About me: =Gustavo/about |
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev