Skip to content

Commit 59c7018

Browse files
committed
Support for starting continuous replication with optional keyword args.
1 parent 485eabb commit 59c7018

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

couchdb/client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,15 @@ def delete(self, name):
209209
"""
210210
del self[name]
211211

212-
def replicate(self, source, target):
212+
def replicate(self, source, target, **options):
213213
"""Replicate changes from the source database to the target database.
214214
215215
:param source: URL of the source database
216216
:param target: URL of the target database
217+
:param options: optional replication args, e.g. continuous=True
217218
"""
218219
data = {'source': source, 'target': target}
220+
data.update(options)
219221
resp, data = self.resource.post('/_replicate', data)
220222
return data
221223

couchdb/tests/client.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,13 @@ def test_replicate(self):
6868
'python-tests')
6969
self.assertEquals(b[id]['test'], 'b')
7070

71+
def test_replicate_continuous(self):
72+
a = self.server.create('python-tests')
73+
b = self.server.create('python-tests-a')
74+
result = self.server.replicate('python-tests', 'python-tests-a', continuous=True)
75+
self.assertEquals(result['ok'], True)
76+
self.assertTrue('_local_id' in result)
77+
7178
class DatabaseTestCase(unittest.TestCase):
7279

7380
def setUp(self):

0 commit comments

Comments
 (0)