Mercurial > hg > Feedworm
diff backend/couchdb/CouchDbBackend.py @ 180:a4832a180c69
allow setting the URL to the database via command line
author | dirk |
---|---|
date | Sat, 10 Sep 2011 04:43:40 +0200 |
parents | 7001070d0bd5 |
children | 1ab48428e2f9 |
line wrap: on
line diff
--- a/backend/couchdb/CouchDbBackend.py Sat Sep 10 04:32:53 2011 +0200 +++ b/backend/couchdb/CouchDbBackend.py Sat Sep 10 04:43:40 2011 +0200 @@ -15,10 +15,16 @@ def __init__(self): CouchDb.init() - server = couchdb.Server() + server = self._initServer() self.database = server[CouchDb.database] self.prefs = None + def _initServer(self): + if CouchDb.database_url is not None: + return couchdb.Server(CouchDb.database_url) + else: + return couchdb.Server() + def preferences(self): if self.prefs is None: self.prefs = Preferences(self.database)