fix PlonePAS's GroupAwareRoleManager for missing self.REQUEST?

5 messages Options
Embed this post
Permalink
Kees Hink

fix PlonePAS's GroupAwareRoleManager for missing self.REQUEST?

Reply Threaded More More options
Print post
Permalink
While working on PLIP 9310 (flexible user registration), i ran into an error
which seems to stem from PlonePAS's GroupAwareRoleManager.
(https://dev.plone.org/plone/ticket/9310#comment:37)

In summary: Calling self.REQUEST (as done in getRolesForPrincipal) yields an
AttributeError, because the GroupAwareRoleManager doesn't have a REQUEST there.
(Also, the method takes an optional 'request' argument, which doesn't seem to
be used.)

The problem with the PLIP goes away if i simply check for the existence of
self.REQUEST first. (See patch in ticket.) Would that be a good idea?

Kees

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Plone-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-developers
Wichert Akkerman

Re: fix PlonePAS's GroupAwareRoleManager for missing self.REQUEST?

Reply Threaded More More options
Print post
Permalink
On 9/20/09 13:36 , Kees Hink wrote:

> While working on PLIP 9310 (flexible user registration), i ran into an error
> which seems to stem from PlonePAS's GroupAwareRoleManager.
> (https://dev.plone.org/plone/ticket/9310#comment:37)
>
> In summary: Calling self.REQUEST (as done in getRolesForPrincipal) yields an
> AttributeError, because the GroupAwareRoleManager doesn't have a REQUEST there.
> (Also, the method takes an optional 'request' argument, which doesn't seem to
> be used.)
>
> The problem with the PLIP goes away if i simply check for the existence of
> self.REQUEST first. (See patch in ticket.) Would that be a good idea?

No, that would be a workaround which covers the real issue: why is the
acquisition wrapping of your PAS plugin incomplete at that point? You
should have an acquisition chain which ends with a RequestContainer
instance. If you don't have that something is off, which can break a PAS
plugin as you have shown.

Wichert.

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Plone-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-developers
Kees Hink

Re: fix PlonePAS's GroupAwareRoleManager for missing self.REQUEST?

Reply Threaded More More options
Print post
Permalink
The question is then: How to create a member? It is worth noting that all our
code tries to do is call portal_registration's addMember. (We're not actually
working on the PAS plugin, just using it.) See
https://svn.plone.org/svn/plone/plone.app.users/branches/plip9310-flexible-member-registration/plone/app/users/browser/joinform.py
for the code which calls 'addMember'.

Wichert Akkerman wrote:

> On 9/20/09 13:36 , Kees Hink wrote:
>> While working on PLIP 9310 (flexible user registration), i ran into an error
>> which seems to stem from PlonePAS's GroupAwareRoleManager.
>> (https://dev.plone.org/plone/ticket/9310#comment:37)
>>
>> In summary: Calling self.REQUEST (as done in getRolesForPrincipal) yields an
>> AttributeError, because the GroupAwareRoleManager doesn't have a REQUEST there.
>> (Also, the method takes an optional 'request' argument, which doesn't seem to
>> be used.)
>>
>> The problem with the PLIP goes away if i simply check for the existence of
>> self.REQUEST first. (See patch in ticket.) Would that be a good idea?
>
> No, that would be a workaround which covers the real issue: why is the
> acquisition wrapping of your PAS plugin incomplete at that point? You
> should have an acquisition chain which ends with a RequestContainer
> instance. If you don't have that something is off, which can break a PAS
> plugin as you have shown.
>
> Wichert.
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry® Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9-12, 2009. Register now!
> http://p.sf.net/sfu/devconf

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Plone-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-developers
Wichert Akkerman

Re: fix PlonePAS's GroupAwareRoleManager for missing self.REQUEST?

Reply Threaded More More options
Print post
Permalink
Have you tried using the simpler and more standard
getToolByName(self.context, 'portal_regstration') instead if getUtility?

Wichert.


On 9/21/09 11:58 , Kees Hink wrote:

> The question is then: How to create a member? It is worth noting that all our
> code tries to do is call portal_registration's addMember. (We're not actually
> working on the PAS plugin, just using it.) See
> https://svn.plone.org/svn/plone/plone.app.users/branches/plip9310-flexible-member-registration/plone/app/users/browser/joinform.py
> for the code which calls 'addMember'.
>
> Wichert Akkerman wrote:
>> On 9/20/09 13:36 , Kees Hink wrote:
>>> While working on PLIP 9310 (flexible user registration), i ran into an error
>>> which seems to stem from PlonePAS's GroupAwareRoleManager.
>>> (https://dev.plone.org/plone/ticket/9310#comment:37)
>>>
>>> In summary: Calling self.REQUEST (as done in getRolesForPrincipal) yields an
>>> AttributeError, because the GroupAwareRoleManager doesn't have a REQUEST there.
>>> (Also, the method takes an optional 'request' argument, which doesn't seem to
>>> be used.)
>>>
>>> The problem with the PLIP goes away if i simply check for the existence of
>>> self.REQUEST first. (See patch in ticket.) Would that be a good idea?
>>
>> No, that would be a workaround which covers the real issue: why is the
>> acquisition wrapping of your PAS plugin incomplete at that point? You
>> should have an acquisition chain which ends with a RequestContainer
>> instance. If you don't have that something is off, which can break a PAS
>> plugin as you have shown.
>>
>> Wichert.
>>
>> ------------------------------------------------------------------------------
>> Come build with us! The BlackBerry® Developer Conference in SF, CA
>> is the only developer event you need to attend this year. Jumpstart your
>> developing skills, take BlackBerry mobile applications to market and stay
>> ahead of the curve. Join us from November 9-12, 2009. Register now!
>> http://p.sf.net/sfu/devconf
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry® Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9-12, 2009. Register now!
> http://p.sf.net/sfu/devconf
> _______________________________________________
> Plone-developers mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/plone-developers


------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Plone-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-developers
Kees Hink

Re: fix PlonePAS's GroupAwareRoleManager for missing self.REQUEST?

Reply Threaded More More options
Print post
Permalink
Just tried it now after your suggestion, and it works. Thanks!

Wichert Akkerman wrote:

> Have you tried using the simpler and more standard
> getToolByName(self.context, 'portal_regstration') instead if getUtility?
>
> Wichert.
>
>
> On 9/21/09 11:58 , Kees Hink wrote:
>> The question is then: How to create a member? It is worth noting that all our
>> code tries to do is call portal_registration's addMember. (We're not actually
>> working on the PAS plugin, just using it.) See
>> https://svn.plone.org/svn/plone/plone.app.users/branches/plip9310-flexible-member-registration/plone/app/users/browser/joinform.py
>> for the code which calls 'addMember'.
>>
>> Wichert Akkerman wrote:
>>> On 9/20/09 13:36 , Kees Hink wrote:
>>>> While working on PLIP 9310 (flexible user registration), i ran into an error
>>>> which seems to stem from PlonePAS's GroupAwareRoleManager.
>>>> (https://dev.plone.org/plone/ticket/9310#comment:37)
>>>>
>>>> In summary: Calling self.REQUEST (as done in getRolesForPrincipal) yields an
>>>> AttributeError, because the GroupAwareRoleManager doesn't have a REQUEST there.
>>>> (Also, the method takes an optional 'request' argument, which doesn't seem to
>>>> be used.)
>>>>
>>>> The problem with the PLIP goes away if i simply check for the existence of
>>>> self.REQUEST first. (See patch in ticket.) Would that be a good idea?
>>> No, that would be a workaround which covers the real issue: why is the
>>> acquisition wrapping of your PAS plugin incomplete at that point? You
>>> should have an acquisition chain which ends with a RequestContainer
>>> instance. If you don't have that something is off, which can break a PAS
>>> plugin as you have shown.
>>>
>>> Wichert.
>>>
>>> ------------------------------------------------------------------------------
>>> Come build with us! The BlackBerry® Developer Conference in SF, CA
>>> is the only developer event you need to attend this year. Jumpstart your
>>> developing skills, take BlackBerry mobile applications to market and stay
>>> ahead of the curve. Join us from November 9-12, 2009. Register now!
>>> http://p.sf.net/sfu/devconf
>> ------------------------------------------------------------------------------
>> Come build with us! The BlackBerry® Developer Conference in SF, CA
>> is the only developer event you need to attend this year. Jumpstart your
>> developing skills, take BlackBerry mobile applications to market and stay
>> ahead of the curve. Join us from November 9-12, 2009. Register now!
>> http://p.sf.net/sfu/devconf
>> _______________________________________________
>> Plone-developers mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/plone-developers
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry® Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9-12, 2009. Register now!
> http://p.sf.net/sfu/devconf

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Plone-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-developers