[Zope-dev] ZPatterns: patch for OLD['name'] for Zope 2.3

Steve Alexander steve@cat-box.net
Sat, 06 Jan 2001 16:23:33 +0000


This is a multi-part message in MIME format.
--------------020802060306080108000104
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Something has changed in the way Zope 2.3 handles the __getitem__ protocol.

This breaks SkinScript's use of OLD.

The fix is to patch Agents.py so that the class _memento explicitly 
provides a __getitem__ method.

ZPatterns may need similar fixes elsewhere. See my message to zope-dev 
earlier this week about the difference in using __getitem__ on Dataskins 
from a Specialist and in the ZODB.

--
Steve Alexander
Software Engineer
Cat-Box limited
http://www.cat-box.net

--------------020802060306080108000104
Content-Type: text/plain;
 name="patch.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="patch.txt"

*** Agents.py.original
--- Agents.py
***************
*** 326,332 ****
          'memento_exprs': 'Keeping:', 'handle_set_for':'Set Attrs:'
      }
      
! class _memento: pass
  _emptyMemento=_memento()
  
  
--- 326,336 ----
          'memento_exprs': 'Keeping:', 'handle_set_for':'Set Attrs:'
      }
      
! class _memento: 
!   __allow_access_to_unprotected_subobjects__=1
!   def __getitem__(self, name):
!     return self.__dict__[name]
! 
  _emptyMemento=_memento()
  
  

--------------020802060306080108000104--