Skip to content
Browse files

small fixes

  • Loading branch information...
1 parent ce94b84 commit 1a4955fd4409a05517faa57bcf5ec5fc78b5bd98 Thomas Vander Stichele committed Sep 11, 2012
Showing with 12 additions and 6 deletions.
  1. +1 −0 TODO
  2. +4 −0 python/mushin/command/main.py
  3. +7 −6 python/mushin/command/replicate.py
View
1 TODO
@@ -8,6 +8,7 @@ gtd (command line client):
without displaying it
- allow asking for password of localhost
- don't use httplib for adding replication; add it to paisley.
+- integrate paisley's use of logging with our logging
- convert all commands to using getNewServer()
- parse search lines and apply filters in most useful order
- Figure out what to do with docs without start date - maybe we have a bug
View
4 python/mushin/command/main.py
@@ -513,6 +513,10 @@ def getNewServer(self):
dbName=self.dbName,
authenticator=InputAuthenticator(self._stdio))
+ # FIXME: big hack: replace the .log attribute which just happens
+ # to have the same signature
+ self._newServer._couch.log = self
+
return self._newServer
def getPassword(self, prompt='Password: '):
View
13 python/mushin/command/replicate.py
@@ -41,13 +41,16 @@ def doLater(self, args):
self.stdout.write('Please give a database to replicate with.\n')
return
+ server = c.getNewServer()
+ # FIXME: don't poke privately
+ client = server._couch
+
# if a username was given, but no password, ask for it
parsed = urlparse.urlparse(url)
password = None
if parsed.username and not parsed.password:
- password = self.getRootCommand().getPassword(
- prompt='Password for %s: ' % url)
-
+ password = c.getPassword(
+ prompt='Password for target database %s: ' % url)
jane = urlrewrite.rewrite(url, hostname=HOST, port=PORT,
password=password, path='/' + DB)
@@ -57,9 +60,6 @@ def doLater(self, args):
jane,
]
- server = c.getNewServer()
- # FIXME: don't poke privately
- client = server._couch
for source, target in [(dbs[0], dbs[1]), (dbs[1], dbs[0])]:
s = json.dumps({
@@ -87,6 +87,7 @@ def doLater(self, args):
except twerror.Error, e:
error = 'CouchDB returned error response %r' % e.status
try:
+ self.debug('CouchDB message: %r', e.message)
r = json.loads(e.message)
error = 'CouchDB returned error reason: %s' % r['reason']
except:

0 comments on commit 1a4955f

Please sign in to comment.
Something went wrong with that request. Please try again.