proxydict problems in 2.8b2 with Localizer
I get "TypeError: object does not support item assignment" in lin 46 och class_init.py. The offending code is "d['_implicit__name__'] = 1" and this is because d is a proxydict. This in turn is caused by Localizer having a class as a class attribute: manage_attributesForm = LocalDTMLFile Apparently, Zope thinks that this class attribute needs a name, but there isn't one. This: manage_attributesForm._needs_name__ = 0 gets rid of the error, but I don't exactly like it. Can anybody shed some light on this, so I can figure out what would be The Right Thing to do? -- Lennart Regebro, Nuxeo http://www.nuxeo.com/ CPS Content Management http://www.cps-project.org/
Lennart Regebro wrote at 2005-5-23 13:29 +0200:
I get "TypeError: object does not support item assignment" in lin 46 och class_init.py.
The offending code is "d['_implicit__name__'] = 1" and this is because d is a proxydict. This in turn is caused by Localizer having a class as a class attribute:
At other places, a similar problem could be solved by "setattr(class, attr, value)" instead of "class.__dict__[attr] = value". -- Dieter
On 5/23/05, Dieter Maurer <dieter@handshake.de> wrote:
Lennart Regebro wrote at 2005-5-23 13:29 +0200:
I get "TypeError: object does not support item assignment" in lin 46 och class_init.py.
The offending code is "d['_implicit__name__'] = 1" and this is because d is a proxydict. This in turn is caused by Localizer having a class as a class attribute:
At other places, a similar problem could be solved by "setattr(class, attr, value)" instead of "class.__dict__[attr] = value".
I also succeeded in working around the problem by setting __name__ and _needs_name__ on the attribute in question, which feels better than my previous workaround. -- Lennart Regebro, Nuxeo http://www.nuxeo.com/ CPS Content Management http://www.cps-project.org/
On 5/23/05, Lennart Regebro <regebro@gmail.com> wrote:
I get "TypeError: object does not support item assignment" in line 46, class_init.py.
I succeeded in working around the problem by setting __name__ and _needs_name__ on the attribute in question,
I still would like a confirmation on wether this is a 2.8bug or a Localizer bug, and if my workaround is the correct one. Possible bug #2 was not a bug, and possible bug #3 has been fixed, so this is the only one left that I encountered. (Well, there are one Five bug and one big Five-omission, as well, but...) -- Lennart Regebro, Nuxeo http://www.nuxeo.com/ CPS Content Management http://www.cps-project.org/
Lennart Regebro <regebro@gmail.com> wrote:
I get "TypeError: object does not support item assignment" in lin 46 och class_init.py.
The offending code is "d['_implicit__name__'] = 1" and this is because d is a proxydict. This in turn is caused by Localizer having a class as a class attribute: manage_attributesForm = LocalDTMLFile Apparently, Zope thinks that this class attribute needs a name, but there isn't one.
I fixed this for the upcoming 2.8.0: http://svn.zope.org/Zope/?rev=30675&view=rev See the unit test for a minimal case. Florent -- Florent Guillaume, Nuxeo (Paris, France) CTO, Director of R&D +33 1 40 33 71 59 http://nuxeo.com fg@nuxeo.com
participants (3)
-
Dieter Maurer -
Florent Guillaume -
Lennart Regebro