>From my initial reading of the code, the create_default_provider()
function in turbogears.identity requires that the class be listed in
this section of entry_points.txt of the TurboGears egg:
[turbogears.identity.provider]
sqlobject =
turbogears.identity.soprovider:SqlObjectIdentityProvider
sqlalchemy=
turbogears.identity.saprovider:SqlAlchemyIdentityProvider
But I don't want to patch the TurboGears files to do this.
What's the right way to do this?
Barry
In branch 1.0 you can just specify your provider "name" directly in
the <proj>/config/app.cfg in the "identity.provider" variable.
As long as your provider is registered with the
"turbogears.identity.provider" entry point it will be found by the
identity loader.
exemple:
your provider has this kind of thing in setup.py:
============================
setup(
name="SuperIDProvider",
version="0.1",
description="the Super ID Provider",
author="You",
author_email="y...@you.com",
url="http://womewhere.org",
download_url="",
license="MIT",
zip_safe=False,
entry_points="""
[turbogears.identity.provider]
mysuperprovider = superprovider.plugin:SuperProvider
""",
test_suite = 'nose.collector',
)
============================
If you install such an egg somewhere in you python path, you just have
to specify in your app.cfg:
identity.provider=mysuperprovider
to have it loaded.
Some explanations:
==============
[turbogears.identity.provider]
mysuperprovider = superprovider.plugin:SuperProvider
Specifies to setuptools that the name "mysuperprovider" is registered
for the entry point turbogears.identity.provider and points to the
class SuperProvider that can be found in the superprovider.plugin
module.
This means your plugin once installed in the python path or in a
registered plugin dir (more in this subject on demand :)) will be
found by any program that executes a:
pkg_resources.iter_entry_points("turbogears.identity.provider",
'mysuperprovider')
Incidentally in branch 1.0 you can now directly specify the name of a
class with a full python name like this:
identity.provider=some.python.module.SuperProvider
but this is less elegant and should not be the preferred way ;-)
Hope it help, my brain is melting-down from overwork at the moment so
excuse my quick and less than complete answer,
Cheers,
Florent.
Barry
Comments and suggestions are welcome,
Tim
--
Timothy Freund
http://digital-achievement.com
http://edodyssey.com