[Zope-dev] Waaagh! Python Script won't allow __setitem__

2001-02-19 Thread Chris Withers
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

Re: [Zope-dev] Waaagh! Python Script won't allow __setitem__

2001-02-19 Thread Evan Simpson
From: Chris Withers [EMAIL PROTECTED] 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 :-( The only way that the security code can know that your __setitem__ is

Re: [Zope-dev] Waaagh! Python Script won't allow __setitem__

2001-02-19 Thread Chris Withers
Evan Simpson wrote: The only way that the security code can know that your __setitem__ is safe is to rename (or alias) it to __guarded_setitem__. Ditto for other such methods. Cool :-) Hmmm... I'm sure __getitem__ works okay though ;-) if type(x) == type(0): Use the Script builtin

Re: [Zope-dev] Waaagh! Python Script won't allow __setitem__

2001-02-19 Thread Evan Simpson
From: Chris Withers [EMAIL PROTECTED] But what's so bad about type()?! When applied to an Extension Class, it gives you access to the actual class, rather than a nice inert type. Cheers, Evan @ digicool 4-am ___ Zope-Dev maillist - [EMAIL

Re: [Zope-dev] Waaagh! Python Script won't allow __setitem__

2001-02-19 Thread Chris Withers
Evan Simpson wrote: From: Chris Withers [EMAIL PROTECTED] But what's so bad about type()?! When applied to an Extension Class, it gives you access to the actual class, rather than a nice inert type. Hmmm arguably a bug in ExtensionClass, but not one I'm gonna try and fix ;-) Oh

Re: [Zope-dev] Waaagh! Python Script won't allow __setitem__

2001-02-19 Thread Phillip J. Eby
At 05:25 PM 2/19/01 +, Chris Withers wrote: Hmmm arguably a bug in ExtensionClass, but not one I'm gonna try and fix ;-) It's not a bug, it's a feature -- the feature that is the reason for the very existence of ExtensionClasses in the first place: merging of the notion of type and