~free.ekanayaka/landscape-client/lucid-1.5.0-0ubuntu0.10.04.0

« back to all changes in this revision

Viewing changes to landscape/broker/remote.py

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-03-18 20:42:05 UTC
  • Revision ID: james.westby@ubuntu.com-20090318204205-v17ejhu5urdsrm7j
Tags: 1.0.28-0ubuntu1
New upstream release. (LP: #343954)

Show diffs side-by-side

added added

removed removed

Lines of Context:
74
74
        result = self._perform_call("get_registered_plugins")
75
75
        return result.addCallback(convert)
76
76
 
 
77
    def get_server_uuid(self):
 
78
        # DBus doesn't like Nones, so we transfer them as empty strings.
 
79
        def empty_string_to_none(uuid):
 
80
            return uuid or None
 
81
        result = self._perform_call("get_server_uuid")
 
82
        result.addCallback(empty_string_to_none)
 
83
        return result
 
84
 
77
85
    def exit(self):
78
86
        return self._perform_call("exit")
79
87
 
118
126
        bus.add_signal_receiver(self._broadcast_resynchronize, "resynchronize")
119
127
        bus.add_signal_receiver(self._broadcast_message_type_acceptance_changed,
120
128
                                "message_type_acceptance_changed")
 
129
        bus.add_signal_receiver(self._broadcast_server_uuid_changed,
 
130
                                "server_uuid_changed")
121
131
 
122
132
 
123
133
    def _broadcast_resynchronize(self):
129
139
 
130
140
    def _broadcast_message_type_acceptance_changed(self, type, acceptance):
131
141
        self.reactor.fire(("message-type-acceptance-changed", type), acceptance)
 
142
 
 
143
    def _broadcast_server_uuid_changed(self, old_uuid, new_uuid):
 
144
        # DBus doesn't work well with Nones, so the signal emitter converts
 
145
        # them to empty strings when sending the signal.  The remote should
 
146
        # then convert them back to Nones so that we have the same API on
 
147
        # both sides.
 
148
        self.reactor.fire("server-uuid-changed",
 
149
                          old_uuid or None, new_uuid or None)
 
150