Mercurial > hg > Feedworm
view backend/couchdb/CouchDb.py @ 215:b7caf487bc54
run make prior to starting the worm
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Mon, 13 May 2013 17:35:11 +0200 |
parents | adf7f617bda9 |
children | bb3c851b18b1 |
line wrap: on
line source
from argparse import ArgumentParser 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): dbname = args[0].dbname if dbname is not None: global database database = dbname def _setDatabaseUrl(args): dburl = args[0].dburl if dburl is not None: 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 design_document + "/feedEntries_by_feed" def unreadFeedEntriesByFeed(): return design_document + "/unread_feedEntries_by_feed" def feeds(): return design_document + "/feeds" def feedEntryByLink(): return design_document + "/feedEntry_by_link" def preference(): return design_document + "/preference" def readFeedEntriesByCreateDate(): return design_document + "/read_feedEntries_by_create_date" def feedsWithUnreadEntries(): return design_document + "/feeds_with_unread_entries"