示例#1
0
 def __setattr__(self, name, value):
     """If name is __parent__, write value to _v_parent. This avoids
     _p_changed to be set set by Persitent.__setattr__. Using a read/write
     property for __parent__ won't work.
     """
     if name == '__parent__':
         name = '_v_parent'
     Persistent.__setattr__(self, name, value)
示例#2
0
 def __setattr__(self, name, value):
   #only run this if the name is within the current objects attributes
   if self._v_book and name not in Persistent.__dict__:
     # if the book exists AND
     # if the value has changed
     # and that attribute is an indexable attribute
     # OR we want it to be indexed, however it is not actually in the index (this condition will be caught 
     # in updateIndexedValue)
     if self._v_book and self.__dict__.get(name) != value and name in self.indexableAttrs:
       self._v_book.updateIndexedValue(self, name, value)
     # save changes
     self._v_book.commitTransaction()
   Persistent.__setattr__(self, name, value)
示例#3
0
    def __setattr__(self, name, value):
        if _special_name(name):
            # Our own attribute names need to go directly to Persistent
            # so that _p_changed gets set, in addition to the _p values themselves
            return Persistent.__setattr__(self, name, value)

        return super(ContainedProxyBase, self).__setattr__(name, value)
示例#4
0
 def __setattr__(self, name, v):
     if name.startswith('_p_') or name in struct_attrs:
         return Persistent.__setattr__(self, name, v)
     # Set _p_changed before calling the mutator on the
     # proxied object, so we have the object marked
     # as dirty even if an exception takes place later.
     self._p_changed = 1
     setattr(self.__proxied__, name, v)