Mercurial > hg > Feedworm
diff backend/couchdb/CouchDb.py @ 169:91a24f499318
introdue an abstraction for the name of the database so it can be changed via commandline parameter
author | dirk |
---|---|
date | Fri, 09 Sep 2011 14:52:54 +0200 |
parents | |
children | d0ced79b5030 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/backend/couchdb/CouchDb.py Fri Sep 09 14:52:54 2011 +0200 @@ -0,0 +1,33 @@ + +from argparse import ArgumentParser + +database = "feedtest" + +def init(): + parser = ArgumentParser() + parser.add_argument("--dbname", nargs="?", help="Name of the database") + args = parser.parse_known_args() + dbname = args[0].dbname + if dbname is not None: + database = dbname + +# +# accessor methods for the various views +# + +def feedEntriesByFeed(): + return database + "/feedEntries_by_feed" + +def unreadFeedEntriesByFeed(): + return database + "/unread_feedEntries_by_feed" + +def feeds(): + return database + "/feeds" + +def feedEntryByLink(): + return database + "/feedEntry_by_link" + +def preference(): + return database + "/preference" + +