CMF, CMFCore/utils.py, Tuple/List incompatibility
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. Cheers Christian -- Christian Theune - ct@gocept.com gocept gmbh & co.kg - schalaunische strasse 6 - 06366 koethen/anhalt tel.+49 3641 511586 - fax.+49 3496 3099118 - mob. +49 179 7808366 reduce(lambda x,y:x+y,[chr(ord(x)^42) for x in 'zS^BED\nX_FOY\x0b'])
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
participants (2)
-
Christian Theune -
Florent Guillaume