Merge lp:~mandel/desktopcouch/fix_direct_access_find_port into lp:desktopcouch

Proposed by Manuel de la Peña
Status: Merged
Approved by: John Lenton
Approved revision: 198
Merged at revision: 202
Proposed branch: lp:~mandel/desktopcouch/fix_direct_access_find_port
Merge into: lp:desktopcouch
Diff against target: 105 lines (+15/-13)
3 files modified
desktopcouch/platform/linux/ipc.py (+5/-4)
desktopcouch/service.py (+6/-5)
desktopcouch/tests/test_service.py (+4/-4)
To merge this branch: bzr merge lp:~mandel/desktopcouch/fix_direct_access_find_port
Reviewer Review Type Date Requested Status
John Lenton (community) Approve
Eric Casteleijn (community) Approve
Review via email: mp+40022@code.launchpad.net

Commit message

Fix the dbus object that exposes the getPort api from desktopcouch.

Description of the change

Fix the dbus object that exposes the getPort api from desktopcouch.

To post a comment you must log in.
Revision history for this message
Eric Casteleijn (thisfred) wrote :

Looks good to me. tests pass.

review: Approve
Revision history for this message
John Lenton (chipaca) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'desktopcouch/platform/linux/ipc.py'
2--- desktopcouch/platform/linux/ipc.py 2010-10-31 21:37:35 +0000
3+++ desktopcouch/platform/linux/ipc.py 2010-11-03 20:59:50 +0000
4@@ -22,13 +22,14 @@
5
6 import dbus.service
7
8-import desktopcouch
9+from desktopcouch.platform.linux import direct_access_find_port
10
11 class PortAdvertiser(dbus.service.Object):
12 "Advertise the discovered port number on the D-Bus Session bus"
13- def __init__(self, death):
14+ def __init__(self, death, ctx):
15 self.conn = dbus.SessionBus()
16 self.death = death
17+ self.ctx = ctx
18 super(PortAdvertiser, self).__init__(object_path="/",
19 conn=self.conn)
20
21@@ -37,10 +38,10 @@
22 bus=self.conn)
23
24 @dbus.service.method(dbus_interface='org.desktopcouch.CouchDB',
25- in_signature='', out_signature='i')
26+ in_signature = '', out_signature = 'i')
27 def getPort(self):
28 "Exported method to return the port"
29- port = int(desktopcouch._direct_access_find_port())
30+ port = int(direct_access_find_port(self.ctx))
31 return port
32
33 @dbus.service.method(dbus_interface='org.desktopcouch.CouchDB',
34
35=== modified file 'desktopcouch/service.py'
36--- desktopcouch/service.py 2010-10-31 21:37:35 +0000
37+++ desktopcouch/service.py 2010-11-03 20:59:50 +0000
38@@ -82,9 +82,9 @@
39 port_finder=desktopcouch.platform.direct_access_find_port,
40 ctx=local_files.DEFAULT_CONTEXT,
41 stop_couchdb=stop_local_couchdb.stop_couchdb,
42- replication=replication,
43+ replication_actions=replication,
44 advertiser_factory=PortAdvertiser,
45- logging=set_up_logging,
46+ set_logging=set_up_logging,
47 resources = pkg_resources,
48 fork=os.fork,
49 nice=os.nice,
50@@ -95,9 +95,9 @@
51 self._port_finder = port_finder
52 self._ctx = ctx
53 self._stop_couchdb = stop_couchdb
54- self._replication = replication
55+ self._replication = replication_actions
56 self._advertiser_factory = advertiser_factory
57- self._logging = logging
58+ self._logging = set_logging
59 self._resources = resources
60 self._fork = fork
61 self._nice = nice
62@@ -116,7 +116,8 @@
63 replication.tear_down(*replication_runtime)
64
65 def _start_server_main(self):
66- portAdvertiser = self._advertiser_factory(self._mainloop.stop)
67+ port_advertiser = self._advertiser_factory(self._mainloop.stop,
68+ self._ctx)
69 logging.debug("starting dbus main loop")
70 try:
71 # we execute the extensions that have been registered
72
73=== modified file 'desktopcouch/tests/test_service.py'
74--- desktopcouch/tests/test_service.py 2010-10-31 18:21:50 +0000
75+++ desktopcouch/tests/test_service.py 2010-11-03 20:59:50 +0000
76@@ -45,9 +45,9 @@
77 port_finder=self._port_finder,
78 ctx=self._ctx,
79 stop_couchdb=self._stop_couchdb,
80- replication=self._replication,
81+ replication_actions=self._replication,
82 advertiser_factory=self._advertiser,
83- logging=set_up_logging,
84+ set_logging=set_up_logging,
85 fork=self._fork,
86 nice=self._nice,
87 kill=self._kill,
88@@ -71,7 +71,7 @@
89 self.mocker.result(234)
90 self._mainloop.stop
91 self.mocker.result(ANY)
92- self._advertiser(ANY)
93+ self._advertiser(ANY, self._ctx)
94 self._resources.iter_entry_points(
95 group=desktopcouch.service.MAIN_START_EXTENSION_ENTRY_POINT)
96 self.mocker.result([])
97@@ -100,7 +100,7 @@
98 self.mocker.result(234)
99 self._mainloop.stop
100 self.mocker.result(ANY)
101- self._advertiser(ANY)
102+ self._advertiser(ANY, self._ctx)
103 self._resources.iter_entry_points(
104 group=desktopcouch.service.MAIN_START_EXTENSION_ENTRY_POINT)
105 self.mocker.result([self._start_extension])

Subscribers

People subscribed via source and target branches