示例#1
0
 def __setitem__(self, key, value):
     if key in self.data:
         raise TypeError("Can't update key in AppendOnlyDict!")
     if isinstance(value, (dict, list)):
         raise TypeError("Can't add non-persistent mutable subobjects!")
     if not PY3:
         from types import InstanceType
         if type(value) is InstanceType:
             if not isinstance(value, Persistent):
                 raise TypeError(
                     "Can't add non-persistent mutable subobjects!")
     PersistentMapping.__setitem__(self, key, value)
示例#2
0
 def __setitem__(self, name, index):
     """ Add an object which implements
     ``repoze.catalog.interfaces.ICatalogIndex`` to the catalog.
     No other type of object may be added to a catalog."""
     if not ICatalogIndex.providedBy(index):
         raise ValueError('%s does not provide ICatalogIndex')
     return PersistentMapping.__setitem__(self, name, index)
示例#3
0
 def __setitem__(self, name, index):
     """ Add an object which implements
     ``repoze.catalog.interfaces.ICatalogIndex`` to the catalog.
     No other type of object may be added to a catalog."""
     if not ICatalogIndex.providedBy(index):
         raise ValueError('%s does not provide ICatalogIndex')
     return PersistentMapping.__setitem__(self, name, index)
示例#4
0
 def __setitem__(self, name, index):
     index.__name__ = name
     return PersistentMapping.__setitem__(self, name, index)
 def __setitem__(self, key, item):
     if not self.data.has_key(key):
         self._keys.append(key)
     return BaseDict.__setitem__(self, key, item)
示例#6
0
 def __setitem__(self, key, value):
     PersistentMapping.__setitem__(self, key, value)
     value.__parent__ = self
     value.__name__ = key
示例#7
0
 def __setitem__(self, name, index):
     index.__name__ = name
     return PersistentMapping.__setitem__(self, name, index)
示例#8
0
 def __setitem__(self, key, value):
     PersistentMapping.__setitem__(self, key, value)
     value.__parent__ = self
     value.__name__ = key