On Wednesday 31 January 2007 05:28, Maciej Wisniowski wrote: > In doc test I may use: > >>> request = TestRequest() > >>> class User(object): > > ... id = 'Jan' > ... title = 'Jan Kowalski' > > >>> request.setPrincipal(User()) > > ..........rest of the test...... > > and after this everything works. > Is this correct way?
Sure, whatever it takes to get it to work. :-) > I also have some code that uses: > > from zope.app.security.interfaces import ILoginPassword > ILoginPassword(self.request).getLogin() > > During tests, I always get None as result of the above > statement. > > So another question, what is the correct way to > get currently authenticated principal id: > request.principal.id or ILoginPassword(self.request).getLogin()? I use request.principal.id. Note that principal.id != principal.login Regards, Stephan -- Stephan Richter CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student) Web2k - Web Software Design, Development and Training _______________________________________________ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users