Thanks, this is very helpful! I had mistakenly assumed that only TurboGears itself could list an entry point in turbogears.identity.provider.
Barry On Jun 19, 4:28 pm, "Florent Aide" <[EMAIL PROTECTED]> wrote: > Hi 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="[EMAIL PROTECTED]", > 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. > > On 6/19/07, Barry Hart <[EMAIL PROTECTED]> wrote: > > > > > I have written a custom identity provider (similar to the existing > > SqlAlchemyIdentityProvider and SqlObjectIdentityProvider classes). In > > TG 1.0.1, how do I ask TG to use my provider instead of these? > > > >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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/turbogears?hl=en -~----------~----~----~----~------~----~------~--~---

