[Zope-dev] CMF, CMFCore/utils.py, Tuple/List incompatibility

Florent Guillaume fg@nuxeo.com
Tue, 19 Nov 2002 18:44:17 +0000 (UTC)


I had the same problem once. It turned out that I had called
manage_setLocalRoles with a tuple instead of a list, but as you found
out some code expects all local roles to be stored as the same sequence
type, and Role.manage_addLocalRoles enforces the invariant that a
changed role is stored as a list.

I think manage_setLocalRoles should be changed to enforce that
invariant.

Florent

Christian Theune  <ct@gocept.com> wrote:
> Hi.
> 
> I get smacked by this:
> 
> [...long traceback...]
> 
>     * Module Products.CMFCore.CatalogTool, line 58, in allowedRolesAndUsers
>     * Module Products.CMFCore.utils, line 200, in _mergedLocalRoles
> 
>     Exception Value  can only concatenate tuple (not "list") to tuple
> 
> The file tells me nothing special. I once fixed it by using 
> 
>     merged[k] = tuple(merged[k]) + tuple(v)
> 
> instead of
> 
>     
>     merged[k] = merged[k] + v
> 
> I don't know if i triggered something bad before, but this code seems to
> be somewhat ... instable ... so maybe forcing it into a tuple maybe a
> good thing.
-- 
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 87  http://nuxeo.com  mailto:fg@nuxeo.com