qubes: Fix property-set events signature

This commit is contained in:
Wojtek Porczyk 2015-06-24 15:36:09 +02:00
parent 7f16e0a73b
commit d4147c52bd

View File

@ -645,18 +645,20 @@ class property(object): # pylint: disable=redefined-builtin,invalid-name
value = self._type(value) value = self._type(value)
if has_oldvalue: if has_oldvalue:
instance.fire_event_pre( instance.fire_event_pre('property-pre-set:' + self.__name__,
'property-pre-set:' + self.__name__, value, oldvalue) self.__name__, value, oldvalue)
else: else:
instance.fire_event_pre('property-pre-set:' + self.__name__, value) instance.fire_event_pre('property-pre-set:' + self.__name__,
self.__name__, value)
instance._property_init(self, value) # pylint: disable=protected-access instance._property_init(self, value) # pylint: disable=protected-access
if has_oldvalue: if has_oldvalue:
instance.fire_event( instance.fire_event('property-set:' + self.__name__, self.__name__,
'property-set:' + self.__name__, value, oldvalue) value, oldvalue)
else: else:
instance.fire_event('property-set:' + self.__name__, value) instance.fire_event('property-set:' + self.__name__, self.__name__,
value)
def __delete__(self, instance): def __delete__(self, instance):
@ -668,17 +670,19 @@ class property(object): # pylint: disable=redefined-builtin,invalid-name
if has_oldvalue: if has_oldvalue:
instance.fire_event_pre('property-pre-deleted:' + self.__name__, instance.fire_event_pre('property-pre-deleted:' + self.__name__,
oldvalue) self.__name__, oldvalue)
else: else:
instance.fire_event_pre('property-pre-deleted:' + self.__name__) instance.fire_event_pre('property-pre-deleted:' + self.__name__,
self.__name__)
delattr(instance, self._attr_name) delattr(instance, self._attr_name)
if has_oldvalue: if has_oldvalue:
instance.fire_event('property-deleted:' + self.__name__, instance.fire_event('property-deleted:' + self.__name__,
oldvalue) self.__name__, oldvalue)
else: else:
instance.fire_event('property-deleted:' + self.__name__) instance.fire_event('property-deleted:' + self.__name__,
self.__name__)
def __repr__(self): def __repr__(self):