[Zope-dev] Adding a new UserSource

Phillip J. Eby pje@telecommunity.com
Sun, 15 Oct 2000 15:43:02 -0500


At 10:10 AM 10/15/00 -0400, Harry Henry Gebel wrote:
>I am trying to add a new UserSource for LoginManager. I placed a directory
>SampleUserSource in /usr/lib/zope/lib/python/Products , in this directory I
>placed two files __init__.py and SampleUserSource.py . Here are the
>contents of the files:
>
>__init__.py:
>
>from SampleUserSource import SampleUserSource
>
>def initialize(context):
>  ''' Register SampleUserSource class as a ZPatterns Plug-in'''
>  context.registerPlugInClass(
>    SampleUserSource,
>    permission = 'Add Sample User Source',
>    constructors = defaultConstructors(SampleUserSource, globals()))
>
>  context.registerBaseClass(SampleUserSource)

You didn't import "defaultConstructors", so your code is erroring out
during the initialize.

Also, there is no reason to register the base class for your user source
unless you plan to make a ZClass subclass of it, which isn't supported in
any released version of ZPatterns.  (0.4.3 will support ZClass subclasses
of PlugIns and PlugInContainers, but you'll have to jump through slightly
different hoops to make them work.)