Hiya Rob!
That did it, thanks a ton.
On Tue, Feb 12, 2008 at 1:28 AM, Rob Miller <[EMAIL PROTECTED]> wrote:
> darian schramm wrote:
> > Hi Everyone,
>
> hi darian!
>
>
>
> > I'm writing some doctests for a custom remember based type, and I'm
> > having some trouble with the member creation process.
> >
> > It seems when I create the custom member using
> > portal_memberdata.invokeFactory(<Type>,id,password) I don't have
> > getRolesInContext available on the resulting object. I've tried
> > calling processForm on the object but no luck.
> >
> > Plone 3.0.5
> > remember/trunk
> > membrane/trunk
> >
> > excerpt from my doctest
> >
> > >>> from Products.CMFCore.utils import getToolByName
> > >>> portal_membership =
> > getToolByName(self.portal,'portal_membership')
> > >>> portal_memberdata =
> getToolByName(self.portal,'portal_memberdata')
> > >>> memid =
> > portal_memberdata.invokeFactory('ZbUser','user1',password='xxxxx')
> > >>> mem = getattr(portal_memberdata,memid)
> > >>> mem
> > <ZbUser at ...>
> >
> >
> > >>> user = mem
> > >>> 'Manager' in user.getRolesInContext(client)
> > True
> >
> > >>> 'TeamMember' in user.getRolesInContext(client)
> > True
> >
> > The last 2 fail with AttributeError: getRolesInContext
>
> you're confusing the member object with the user object. it's an unfortunate
> fact that, for historical reasons, each authenticated user has two different
> types of objects associated with him, a 'member' object which contains
> general
> member data and a 'user' object that interacts with the Zope security stuff.
>
> change your "user = mem" line to "user = mem.getUser()" and you'll probably
> have more luck.
>
> -r
>
>
> --
> Archive:
> http://www.openplans.org/projects/remember/lists/remember/archive/2008/02/1202797696753
> To unsubscribe send an email with subject unsubscribe to [EMAIL PROTECTED]
> Please contact [EMAIL PROTECTED] for questions.
>
>
--
Darian V Schramm
--
Archive:
http://www.openplans.org/projects/remember/lists/remember/archive/2008/02/1202837066715
To unsubscribe send an email with subject unsubscribe to [EMAIL PROTECTED]
Please contact [EMAIL PROTECTED] for questions.