Mercurial > hg > Feedworm
changeset 205:adf7f617bda9
make the name of the design document configurable via command line switch. When cloning the feedworm db, the design document is no longer the same as the database name
author | dirk |
---|---|
date | Sat, 02 Jun 2012 04:24:49 +0200 |
parents | 4cb22b47b659 |
children | f74fe7cb5091 |
files | backend/couchdb/CouchDb.py |
diffstat | 1 files changed, 16 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/backend/couchdb/CouchDb.py Tue Apr 03 05:35:13 2012 +0200 +++ b/backend/couchdb/CouchDb.py Sat Jun 02 04:24:49 2012 +0200 @@ -3,16 +3,19 @@ database_url = None database = "feedworm" +design_document = database def init(): args = _parseArguments() _setDatabaseName(args) _setDatabaseUrl(args) + _setDesignDocument(args) def _parseArguments(): parser = ArgumentParser() parser.add_argument("--dbname", nargs="?", help="Name of the database") parser.add_argument("--dburl", nargs="?", help="URL of the database") + parser.add_argument("--designdoc", nargs="?", help="name of the feedworm design document") return parser.parse_known_args() def _setDatabaseName(args): @@ -27,27 +30,33 @@ global database_url database_url = dburl +def _setDesignDocument(args): + designDocument = args[0].designdoc + if designDocument is not None: + global design_document + design_document = designDocument + # # accessor methods for the various views # def feedEntriesByFeed(): - return database + "/feedEntries_by_feed" + return design_document + "/feedEntries_by_feed" def unreadFeedEntriesByFeed(): - return database + "/unread_feedEntries_by_feed" + return design_document + "/unread_feedEntries_by_feed" def feeds(): - return database + "/feeds" + return design_document + "/feeds" def feedEntryByLink(): - return database + "/feedEntry_by_link" + return design_document + "/feedEntry_by_link" def preference(): - return database + "/preference" + return design_document + "/preference" def readFeedEntriesByCreateDate(): - return database + "/read_feedEntries_by_create_date" + return design_document + "/read_feedEntries_by_create_date" def feedsWithUnreadEntries(): - return database + "/feeds_with_unread_entries" + return design_document + "/feeds_with_unread_entries"