Exemple #1
0
    def __init__(self, plist=[]):
        """
			Initializer. Argument:
			- plist: Node or list of 'Property'."""
        Dictionary.__init__(self)
        self.order = []
        for p in plist:
            self.addProperty(p)
Exemple #2
0
 def __init__(self, plist=[]):
     """
         Initializer. Argument:
         - plist: Node or list of 'Property'."""
     Dictionary.__init__(self)
     self.order = []
     for p in plist:
         self.addProperty(p)
Exemple #3
0
 def __setitem__(self, key, x):
     """ On 'self[key]=x'. Allows assignment to existing items only. Raises 
         'DirectAccessError' on new item assignment."""
     if self.has_key(key):
         self.order[self.order.index(self[key])] = x
         Dictionary.__setitem__(self, key, x)
     else:
         raise DirectAccessError(
             "Properties may not be added directly; use addProperty() instead.")
Exemple #4
0
 def __setitem__(self, key, x):
     """ On 'self[key]=x'. Allows assignment to existing items only. Raises 
         'DirectAccessError' on new item assignment."""
     if self.has_key(key):
         self.order[self.order.index(self[key])] = x
         Dictionary.__setitem__(self, key, x)
     else:
         raise DirectAccessError(
             "Properties may not be added directly; use addProperty() instead.")
Exemple #5
0
 def __delitem__(self, key):
     """ On 'del self[key]'. Updates 'self.order' to maintain consistency."""
     self.order.remove(self[key])
     Dictionary.__delitem__(self, key)
Exemple #6
0
 def __delitem__(self, key):
     """ On 'del self[key]'. Updates 'self.order' to maintain consistency."""
     self.order.remove(self[key])
     Dictionary.__delitem__(self, key)