# HG changeset patch # User dirk # Date 1338603889 -7200 # Node ID adf7f617bda9edc71f3a4433bc790fadc5a9215f # Parent 4cb22b47b659d217556f69aebbdad315b87b3503 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 diff -r 4cb22b47b659 -r adf7f617bda9 backend/couchdb/CouchDb.py --- 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"