Changeset 1117

Show
Ignore:
Timestamp:
09/26/07 22:03:50 (14 months ago)
Author:
wichert
Message:

Add a delitem implementation to Packet. Based on a patch from Alexey V Michurun <am@…>

Location:
trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/CHANGES.txt

    r1116 r1117  
    44* Make Packet.has_key and __contains__ gracefully handle unknown attributes.  
    55  Based on a patch from Alexey V Michurun <am@rol.ru>. 
     6 
     7* Add a __delitem__ implementation to Packet. Based on a patch from 
     8  Alexey V Michurun <am@rol.ru>. 
     9 
    610 
    711Pyrad 1.0 
  • trunk/pyrad/packet.py

    r1116 r1117  
    182182 
    183183 
     184        def __delitem__(self, key): 
     185                del self.data[self._EncodeKey(key)] 
     186 
     187 
    184188        def __setitem__(self, key, item): 
    185189                if type(key)==types.StringType: 
  • trunk/pyrad/tests/testPacket.py

    r1116 r1117  
    123123        self.assertEqual("Unknown-Attribute" in self.packet, False) 
    124124 
     125     
     126    def testDelItem(self): 
     127        self.packet["Test-String"]="dummy" 
     128        del self.packet["Test-String"] 
     129        self.assertEqual(self.packet.has_key("Test-String"), False) 
     130        self.packet["Test-String"]="dummy" 
     131        del self.packet[1] 
     132        self.assertEqual(self.packet.has_key("Test-String"), False) 
     133 
    125134 
    126135    def testKeys(self):