Warning:
Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.
Ticket #1178: custom_identity_provider.diff
| File custom_identity_provider.diff,
1.3 KB
(added by aalbrecht, 5 years ago) |
|
Workaround: Use load_class to treat config option as a class path
|
-
|
|
|
|
| 10 | 10 | log = logging.getLogger("turbogears.identity") |
| 11 | 11 | |
| 12 | 12 | import turbogears |
| 13 | | from turbogears.util import request_available |
| | 13 | from turbogears.util import request_available, load_class |
| 14 | 14 | from turbogears.identity.exceptions import * |
| 15 | 15 | |
| 16 | 16 | def create_default_provider(): |
| … |
… |
|
| 19 | 19 | provider_plugin ) |
| 20 | 20 | |
| 21 | 21 | log.debug( "Loading provider from plugin: %s", provider_plugin ) |
| 22 | | |
| | 22 | |
| | 23 | provider_class = None |
| 23 | 24 | for entrypoint in plugins: |
| 24 | | plugin= entrypoint.load() |
| 25 | | return plugin() |
| | 25 | provider_class = entrypoint.load() |
| | 26 | break |
| | 27 | |
| | 28 | if not provider_class: |
| | 29 | provider_class = load_class(provider_plugin) |
| 26 | 30 | |
| 27 | | raise IdentityConfigurationException( "IdentityProvider plugin missing: %s" % |
| 28 | | provider_plugin ) |
| | 31 | if not provider_class: |
| | 32 | raise IdentityConfigurationException( "IdentityProvider plugin missing: %s" % |
| | 33 | provider_plugin ) |
| | 34 | else: |
| | 35 | return provider_class() |
| 29 | 36 | |
| 30 | 37 | |
| 31 | 38 | class IdentityWrapper(object): |
Download in other formats: