> [1] > > self._register_handlers() > if self._bus: > - return self._interface.register(config_path, > - reply_handler=reply_handler, > - error_handler=error_handler) > + try: > + result, message = self._interface.register(config_path) > + except dbus.DBusException, e: > + if e.get_dbus_name() != "org.freedesktop.DBus.Error.NoReply": > + raise > + else: > + error_handler("Registration timed out.") > + if result: > > The "result" variable will be undefined if error_handler() is called, and > indeed TimeoutTest.test_register fails: > > > landscape.ui.model.registration.tests.test_proxy > TimeoutTest > test_register ... > [ERROR] > > ============================================================================== > = > [ERROR] > Traceback (most recent call last): > File "/home/free/src/client/trunk/landscape/tests/mocker.py", line 146, in > test_method_wrapper > result = test_method() > File "/home/free/src/client/trunk/landscape/ui/model/registration/tests/test > _proxy.py", line 64, in test_register > self.proxy.register("foo", error_handler=fake_error_handler) > File "/home/free/src/client/trunk/landscape/ui/model/registration/proxy.py", > line 116, in register > if result: > exceptions.UnboundLocalError: local variable 'result' referenced before > assignment > > landscape.ui.model.registration.tests.test_proxy.TimeoutTest.test_register > ------------------------------------------------------------------------------ > - > Ran 1 tests in 0.003s
Yup - quite right. Now fixed.
« Back to merge proposal
> [1] handlers( ) .register( config_ path, reply_handler, error_handler) .register( config_ path) p.DBus. Error.NoReply" : "Registration timed out.") test_register fails: ui.model. registration. tests.test_ proxy ======= ======= ======= ======= ======= ======= ======= ======= ======= ======= = free/src/ client/ trunk/landscape /tests/ mocker. py", line 146, in free/src/ client/ trunk/landscape /ui/model/ registration/ tests/test register( "foo", error_handler= fake_error_ handler) free/src/ client/ trunk/landscape /ui/model/ registration/ proxy.py" , UnboundLocalErr or: local variable 'result' referenced before ui.model. registration. tests.test_ proxy.TimeoutTe st.test_ register ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- -
>
> self._register_
> if self._bus:
> - return self._interface
> - reply_handler=
> - error_handler=
> + try:
> + result, message = self._interface
> + except dbus.DBusException, e:
> + if e.get_dbus_name() != "org.freedeskto
> + raise
> + else:
> + error_handler(
> + if result:
>
> The "result" variable will be undefined if error_handler() is called, and
> indeed TimeoutTest.
>
>
> landscape.
> TimeoutTest
> test_register ...
> [ERROR]
>
> =======
> =
> [ERROR]
> Traceback (most recent call last):
> File "/home/
> test_method_wrapper
> result = test_method()
> File "/home/
> _proxy.py", line 64, in test_register
> self.proxy.
> File "/home/
> line 116, in register
> if result:
> exceptions.
> assignment
>
> landscape.
> -------
> -
> Ran 1 tests in 0.003s
Yup - quite right. Now fixed.