changeset 2370:6d9970321d79

disable openid preferences if openid libs are not installed
author Johannes Berg <johannes AT sipsolutions DOT net>
date Thu, 12 Jul 2007 11:45:51 +0200
parents ccf996479233
children 7de0a5eebf76
files MoinMoin/userprefs/oid.py
diffstat 1 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/userprefs/oid.py	Thu Jul 12 11:41:35 2007 +0200
+++ b/MoinMoin/userprefs/oid.py	Thu Jul 12 11:45:51 2007 +0200
@@ -9,12 +9,16 @@
 from MoinMoin import wikiutil, user
 from MoinMoin.widget import html
 from MoinMoin.userprefs import UserPrefBase
-from MoinMoin.auth.openidrp import OpenIDAuth
 import sha
-from MoinMoin.util.moinoid import MoinOpenIDStore
-from openid.consumer import consumer
-from openid.yadis.discover import DiscoveryFailure
-from openid.fetchers import HTTPFetchingError
+try:
+    from MoinMoin.auth.openidrp import OpenIDAuth
+    from MoinMoin.util.moinoid import MoinOpenIDStore
+    from openid.consumer import consumer
+    from openid.yadis.discover import DiscoveryFailure
+    from openid.fetchers import HTTPFetchingError
+    _openid_disabled = False
+except ImportError:
+    _openid_disabled = True
 
 
 class Settings(UserPrefBase):
@@ -27,6 +31,8 @@
         self.title = self._("OpenID settings")
 
     def allowed(self):
+        if _openid_disabled:
+            return False
         for authm in self.request.cfg.auth:
             if isinstance(authm, OpenIDAuth):
                 return UserPrefBase.allowed(self)