Ticket #5542 (closed Bug: fixed)

Opened 6 years ago

Last modified 6 years ago

getInheritedLocalRoles in PloneTool fails with "AttributeError: acl_users"

Reported by: partecs Owned by:
Priority: major Milestone: 2.5.1
Component: Infrastructure Keywords: PloneTool
Cc:

Description (last modified by wichert) (diff)

I have a catalog index which calls computeRoleMap(). This in turn calls getInheriredLocalRoles() which fails on the following line:

        if portal != here:
            parent = here.aq_parent
            while cont:
!!!=>           userroles = parent.acl_users.getLocalRolesForDisplay(parent)
                for user, roles, role_type, name in userroles:
                    # Find user in result

Seems that parent has lost its acquisition underwear somewhere!

So I made a small change:

        if portal != here:
            parent = here.aq_parent
            while cont:
+++ FIX         if not getattr(parent, 'acl_users', None):
+++ FIX              break
                userroles = parent.acl_users.getLocalRolesForDisplay(parent)
                for user, roles, role_type, name in userroles:
                    # Find user in result

Now all is well!

Change History

comment:1 Changed 6 years ago by partecs

Sorry... I should have done a page preview:

I have a catalog index which calls computeRoleMap(). This in turn calls getInheriredLocalRoles() which fails on the following line:

    if portal != here:
        parent = here.aq_parent
        while cont:
 !!!=>      userroles = parent.acl_users.getLocalRolesForDisplay(parent)
            for user, roles, role_type, name in userroles:
                # Find user in result

Seems that parent has lost its acquisition underwear somewhere!

So I made a small change:

     if portal != here:
         parent = here.aq_parent
         while cont:
+++ FIX      if not getattr(parent, 'acl_users', None):
+++ FIX          break
             userroles = parent.acl_users.getLocalRolesForDisplay(parent)
             for user, roles, role_type, name in userroles:
                   # Find user in result

Now all is well!

comment:2 Changed 6 years ago by wichert

  • Description modified (diff)

comment:3 Changed 6 years ago by hannosch

  • Status changed from new to closed
  • Resolution set to fixed

(In [10385]) Made getInheritedLocalRoles in PloneTool more error resilient. This closes #5542.

comment:4 Changed 6 years ago by hannosch

  • Milestone changed from 2.1.x to 2.5.1
Note: See TracTickets for help on using tickets.