diff MoinMoin/config/multiconfig.py @ 5971:96ef8a8ecc80

improve some passlib related code using the 1.6.1-post-release doc updates catch all exceptions that might happen when creating CryptContext remove compatibility hack - as hash_needs_update removal was delayed to passlib 2.0, we can just use the deprecated method name to support older and current passlib versions.
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 16 Mar 2013 21:47:54 +0100
parents 9894a3344118
children 35bf45b53714
line wrap: on
line diff
--- a/MoinMoin/config/multiconfig.py	Sat Mar 16 18:29:13 2013 +0100
+++ b/MoinMoin/config/multiconfig.py	Sat Mar 16 21:47:54 2013 +0100
@@ -433,13 +433,15 @@
         if self.passlib_support:
                 from passlib.context import CryptContext
+                from passlib.exc import UserWarning
             except ImportError, err:
                 raise error.ConfigurationError("Wiki is configured to use passlib, but importing passlib failed [%s]!" % str(err))
                 self.cache.pwd_context = CryptContext(**self.passlib_crypt_context)
-            except (ValueError, KeyError), err:
+            except (ValueError, KeyError, TypeError, UserWarning), err:
                 # ValueError: wrong configuration values
                 # KeyError: unsupported hash (seen with passlib 1.3)
+                # TypeError: configuration value has wrong type
                 raise error.ConfigurationError("passlib_crypt_context configuration is invalid [%s]." % str(err))
         elif self.password_scheme == '{PASSLIB}':
             raise error.ConfigurationError("passlib_support is switched off, thus you can't use password_scheme = '{PASSLIB}'.")