[Zope] Broken ZDiscussions-0.5.3 on 2.2.1b1: missing comma...
J M Cerqueira Esteves
jmce@artenumerica.com
Mon, 21 Aug 2000 12:28:44 +0100
I tried to install ZDiscussions (ZUBB) 0.5.3 it on a Zope 2.2.1b1 and got
a broken product. The traceback I got at Zope startup was:
2000-08-21T01:44:09 ERROR(200) Zope Couldn't import Products.ZDBase
Traceback (innermost last):
File /usr/local/lib/Zope-2.2.1b1/lib/python/OFS/Application.py, line 396,
in import_products (Object: string)
File /var/lib/zope/an/Products/ZDBase/__init__.py, line 86, in ?
File /var/lib/zope/an/Products/ZDBase/ZDiscussions.py, line 106, in ?
File /usr/local/lib/Zope-2.2.1b1/lib/python/App/class_init.py, line 109,
in default__class_init__ (Object: ZDItem)
File /usr/local/lib/Zope-2.2.1b1/lib/python/AccessControl/Permission.py,
line 204, in registerPermissions
ValueError: unpack sequence of wrong size
The problem seems to be a missing comma in the definition of__ac_permissions__
in class ZDItem (file ZDiscussions.py):
__ac_permissions__ = (
('Manage properties', ('manage_addProperty',
'manage_editProperties',
'manage_delProperties',
'manage_changeProperties',))
)
Since this is lacking a comma before the last parenthesis,
outer parentheses are "dropped" and it becomes as a two-element tuple:
((X,methods)) -> (X,methods)
that is, a "naked" permission, instead of the intended one-element (one
permission) tuple ((X,methods),).
In fact, ac_permissions_ was already defined like this in ZDiscussions-0.2.0...
I wonder if this was clearly noticed before 2.2.1b1, since line 204 of
Permission.py (see traceback above) belongs to a new function called
`registerPermissions'. This function begins with
for setting in permissions:
if _registerdPermission(setting[0]): continue
if len(setting)==2:
perm, methods = setting
default = defaultDefault
else:
perm, methods, default = setting
_registeredPermissions[perm]=1
and with the bug above, its easy to see the mess resulting when `permissions'
has the above __ac_permissions__ value.
Apart from this, is ZDiscussions (ZUBB) 0.5.3 fully compatible with
Zope 2.2.1? I just restarted Zope after adding the comma and the
product is no longer broken. Perhaps I can do some testing now...
Best regards
--
jmce: +351 919838775 ~ http://artenumerica.com/ ~ http://artenumerica.org/