/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

Bug fix: Make D-Bus properties settable again.

* mandos (ClientDBus.notifychangeproperty/setter): Bug fix: pass
                                                   variant_level as a
                                                   keyword argument.
  (ClientDBus.Timeout_dbus_property): Bug fix: call function
                                      _timedelta_to_milliseconds in
                                      its new position as a global
                                      function.

Show diffs side-by-side

added added

removed removed

Lines of Context:
891
891
        """ Modify a variable so that it's a property which announces
892
892
        its changes to DBus.
893
893
 
894
 
        transform_fun: Function that takes a value and transforms it
895
 
                       to a D-Bus type.
 
894
        transform_fun: Function that takes a value and a variant_level
 
895
                       and transforms it to a D-Bus type.
896
896
        dbus_name: D-Bus name of the variable
897
897
        type_func: Function that transform the value before sending it
898
898
                   to the D-Bus.  Default: no transform
905
905
                    type_func(getattr(self, attrname, None))
906
906
                    != type_func(value)):
907
907
                    dbus_value = transform_func(type_func(value),
908
 
                                                variant_level)
 
908
                                                variant_level
 
909
                                                =variant_level)
909
910
                    self.PropertyChanged(dbus.String(dbus_name),
910
911
                                         dbus_value)
911
912
            setattr(self, attrname, value)
1187
1188
        gobject.source_remove(self.disable_initiator_tag)
1188
1189
        self.disable_initiator_tag = None
1189
1190
        self.expires = None
1190
 
        time_to_die = (self.
1191
 
                       _timedelta_to_milliseconds((self
1192
 
                                                   .last_checked_ok
1193
 
                                                   + self.timeout)
1194
 
                                                  - datetime.datetime
1195
 
                                                  .utcnow()))
 
1191
        time_to_die = _timedelta_to_milliseconds((self
 
1192
                                                  .last_checked_ok
 
1193
                                                  + self.timeout)
 
1194
                                                 - datetime.datetime
 
1195
                                                 .utcnow())
1196
1196
        if time_to_die <= 0:
1197
1197
            # The timeout has passed
1198
1198
            self.disable()