Merge lp:~zeitgeist/zeitgeist/bug695363 into lp:zeitgeist/0.1
Proposed by
Siegfried Gevatter
Status: | Merged |
---|---|
Merged at revision: | 1668 |
Proposed branch: | lp:~zeitgeist/zeitgeist/bug695363 |
Merge into: | lp:zeitgeist/0.1 |
Diff against target: |
172 lines (+104/-13) 2 files modified
test/remote-test.py (+51/-10) zeitgeist/client.py (+53/-3) |
To merge this branch: | bzr merge lp:~zeitgeist/zeitgeist/bug695363 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mikkel Kamstrup Erlandsen | Approve | ||
Review via email: mp+48950@code.launchpad.net |
Description of the change
Expose DataSourceRegis
To post a comment you must log in.
review needsfixing
> === modified file 'test/remote- test.py' mainloop( self): timeout_ add_seconds( 30, cb_timeout)
> + def _create_
> + mainloop = gobject.MainLoop()
> +
> + def cb_timeout():
> + mainloop.quit()
> + self.fail("Timed out -- operations not completed in reasonable time.")
> +
> + # Add an arbitrary timeout so this test won't block if it fails
> + gobject.
I think 5s ought to be more than enough here? No-one will ever wait
30s for the timeout before they kill the proces anyway :-)
> === modified file 'zeitgeist/ client. py' source_ enabled_ callback( self, unique_id, enabled_callback): data_source before. source_ enabled_ callback( ) called before ' \ data_source( )' enabled_ callback) , \ sources[ unique_ id]['callback' ] = enabled_callback
> + def set_data_
> + """
> + This method may only be used after having registered the given unique_id
> + with register_
> +
> + It registers a method to be called whenever the `enabled' status of
> + the previously registered data-source changes.
> +
> + Remember that on some systems the DataSourceRegistry extension may be
> + disabled, in which case this method will have no effect.
> + """
> +
> + assert unique_id in self._data_sources, \
> + 'set_data_
> + 'register_
> +
> + assert callable(
> + 'enabled_callback: expected a callable method'
> +
> + self._data_
I don't think it's nice to assert in a library. You should throw
ValueError or TypeErrors instead I think.