[Checkins] SVN: Products.PluggableAuthService/branches/maurits-login-transform/Products/PluggableAuthService/PluggableAuthService.py Be forgiving when IUserEnumerationPlugins miss one of the new methods.

Maurits van Rees cvs-admin at zope.org
Sat Jan 19 21:31:45 UTC 2013


Log message for revision 129058:
  Be forgiving when IUserEnumerationPlugins miss one of the new methods.

Changed:
  U   Products.PluggableAuthService/branches/maurits-login-transform/Products/PluggableAuthService/PluggableAuthService.py

-=-
Modified: Products.PluggableAuthService/branches/maurits-login-transform/Products/PluggableAuthService/PluggableAuthService.py
===================================================================
--- Products.PluggableAuthService/branches/maurits-login-transform/Products/PluggableAuthService/PluggableAuthService.py	2013-01-19 19:08:42 UTC (rev 129057)
+++ Products.PluggableAuthService/branches/maurits-login-transform/Products/PluggableAuthService/PluggableAuthService.py	2013-01-19 21:31:44 UTC (rev 129058)
@@ -1280,6 +1280,12 @@
         # silently.
         success = False
         for updater_id, updater in updaters:
+            if not hasattr(updater, 'updateUser'):
+                # This was a later addition to the interface, so we
+                # are forgiving.
+                logger.warn("%s plugin lacks updateUser method of "
+                            "IUserEnumerationPlugin.", updater_id)
+                continue
             try:
                 updater.updateUser(user_id, login_name)
             except _SWALLOWABLE_PLUGIN_EXCEPTIONS:
@@ -1316,6 +1322,12 @@
         # silently.
         success = False
         for updater_id, updater in updaters:
+            if not hasattr(updater, 'updateUser'):
+                # This was a later addition to the interface, so we
+                # are forgiving.
+                logger.warn("%s plugin lacks updateUser method of "
+                            "IUserEnumerationPlugin.", updater_id)
+                continue
             try:
                 updater.updateUser(user_id, login_name)
             except _SWALLOWABLE_PLUGIN_EXCEPTIONS:
@@ -1344,6 +1356,12 @@
         plugins = self._getOb('plugins')
         updaters = plugins.listPlugins(IUserEnumerationPlugin)
         for updater_id, updater in updaters:
+            if not hasattr(updater, 'updateEveryLoginName'):
+                # This was a later addition to the interface, so we
+                # are forgiving.
+                logger.warn("%s plugin lacks updateEveryLoginName method of "
+                            "IUserEnumerationPlugin.", updater_id)
+                continue
             # Note: do not swallow any exceptions here.
             updater.updateEveryLoginName(
                 quit_on_first_error=quit_on_first_error)



More information about the checkins mailing list