Re: [Zope-dev] Trouble setting LoginManager default user class
Phillip J. Eby writes:
At 10:01 PM 5/17/00 +0100, Steve Alexander wrote:
The _defaultClass only needs to become DemoPortal.LoginMember before a Portal's LoginManager instance is created.
Therefore, you can leave the _defaultClass as LoginUser until the "install" method of DemoPortalBase is called (PTKDemo/Portal.py).
In the "install" method, after creating a MembersClass(), set its _defaultClass to LoginMember.
It would be better to call manage_setStorage(zclass='meta type') rather than tinkering with attributes directly, as manage_setStorage should always be forward-compatible.
Ah yes, forgot about this problem -- it was yesterday... Here's my current code from DemoPortalBase.install: elif db == 'LoginManager': from Products.LoginManager.LoginManager import \ LoginManager, manage_addLoginManager from PersistentUserSource import PersistentUserSource self.MembersClass = LoginManager # maybe not needed anymore manage_addLoginManager(self, 'Persistent User Source', ['Basic Auth Login'], 0, 0, 0) #self.acl_users.manage_setStorage('DemoPortal/LoginMember') for us in self.acl_users.UserSourcesGroup.objectValues(): if us.meta_type == 'Persistent User Source': us.manage_setStorage('DemoPortal/LoginMember') The commented out line fails because it doesn't have a manage_setStorage. The uncommented out code causes the following traceback. It was after I hit this that I started hacking on _defaultClass... Probably I should have yelled for help then, but I have this bad habit of digging myself in as far a possible first :-) Traceback (innermost last): File /home/zope/lib/python/ZPublisher/Publish.py, line 214, in publish_module File /home/zope/lib/python/ZPublisher/Publish.py, line 179, in publish File /home/zope/lib/python/Zope/__init__.py, line 202, in zpublisher_exception_hook File /home/zope/lib/python/ZPublisher/Publish.py, line 165, in publish File /home/zope/lib/python/ZPublisher/mapply.py, line 160, in mapply (Object: Portal_add) File /home/zope/lib/python/ZPublisher/Publish.py, line 102, in call_object (Object: Portal_add) File /home/zope/lib/python/OFS/DTMLMethod.py, line 150, in __call__ (Object: Portal_add) File /home/zope/lib/python/DocumentTemplate/DT_String.py, line 502, in __call__ (Object: Portal_add) File /home/zope/lib/python/DocumentTemplate/DT_With.py, line 148, in render (Object: Portal.createInObjectManager(REQUEST['id'], REQUEST)) File /home/zope/lib/python/Products/PTKDemo/Portal.py, line 71, in install (Object: DemoPortalBase) File /home/dan/src/Zope-2.1.6-src/lib/python/Products/ZPatterns/Rack.py, line 348, in manage_setStorage (Object: AttributeProviderContainer) File /home/dan/src/Zope-2.1.6-src/lib/python/Products/ZPatterns/Rack.py, line 225, in _unifiedZClassRegistry (Object: AttributeProviderContainer) AttributeError: (see above)
participants (1)
-
Dan L. Pierson