[Zope-dev] Waaagh! Python Script won't allow __setitem__
Chris Withers
chrisw@nipltd.com
Mon, 19 Feb 2001 16:28:15 +0000
Hi,
I've got an object which implements __setitem__ in such a way that it's
perfectly safe for use in Python Scripts. Sadly, it seems that Evan's Byte Code
hacks won't let me do this :-(
Whenever I try to do something like: myobject['fish']=1, I get a traceback like
the following:
Traceback (innermost last):
File E:\Zope\237994~1.0\lib\python\Shared\DC\Scripts\Bindings.py, line 324, in
__call__
(Object: ThePythonScript)
File E:\Zope\237994~1.0\lib\python\Shared\DC\Scripts\Bindings.py, line 353, in
_bindAndExec
(Object: ThePythonScript)
File E:\Zope\237994~1.0\lib\python\Products\PythonScripts\PythonScript.py, line
330, in _exec
(Object: ThePythonScript)
(Info: ({'script': <PythonScript instance at 016D16F0>, 'container': <AProduct
instance at 01923AA0>, 'traverse_subpath': [], 'context': <AnotherProduct
instance at 01888250>}, ({<a dictionary of arguments>},), {}, None))
File Script (Python), line 6, in ThePythonScript
File
E:\Zope\237994~1.0\lib\python\Products\PythonScripts\zbytecodehacks\VSExec.py,
line 429, in __setitem__
TypeError: (see above)
Is there any way I can get around this other than renaming __setitem__ to set,
which screws up the nice python syntax?
cheers,
Chris