/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to mandos

* mandos (ClientDBus.notifychangeproperty): Bug fix: Use instance
                                            attributes instead of
                                            class attributes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
898
898
                   to the D-Bus.  Default: no transform
899
899
        variant_level: D-Bus variant level.  Default: 1
900
900
        """
901
 
        real_value = [None,]
 
901
        attrname = "_{0}".format(dbus_name)
902
902
        def setter(self, value):
903
 
            old_value = real_value[0]
904
 
            real_value[0] = value
905
903
            if hasattr(self, "dbus_object_path"):
906
 
                if type_func(old_value) != type_func(real_value[0]):
907
 
                    dbus_value = transform_func(type_func
908
 
                                                (real_value[0]),
 
904
                if (not hasattr(self, attrname) or
 
905
                    type_func(getattr(self, attrname, None))
 
906
                    != type_func(value)):
 
907
                    dbus_value = transform_func(type_func(value),
909
908
                                                variant_level)
910
909
                    self.PropertyChanged(dbus.String(dbus_name),
911
910
                                         dbus_value)
 
911
            setattr(self, attrname, value)
912
912
        
913
 
        return property(lambda self: real_value[0], setter)
 
913
        return property(lambda self: getattr(self, attrname), setter)
914
914
    
915
915
    
916
916
    expires = notifychangeproperty(datetime_to_dbus, "Expires")