Mercurial > hg > Feedworm
annotate 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 |
rev | line source |
---|---|
169
91a24f499318
introdue an abstraction for the name of the database so it can be changed via commandline parameter
dirk
parents:
diff
changeset
|
1 |
91a24f499318
introdue an abstraction for the name of the database so it can be changed via commandline parameter
dirk
parents:
diff
changeset
|
2 from argparse import ArgumentParser |
91a24f499318
introdue an abstraction for the name of the database so it can be changed via commandline parameter
dirk
parents:
diff
changeset
|
3 |
91a24f499318
introdue an abstraction for the name of the database so it can be changed via commandline parameter
dirk
parents:
diff
changeset
|
4 database = "feedtest" |
91a24f499318
introdue an abstraction for the name of the database so it can be changed via commandline parameter
dirk
parents:
diff
changeset
|
5 |
91a24f499318
introdue an abstraction for the name of the database so it can be changed via commandline parameter
dirk
parents:
diff
changeset
|
6 def init(): |
91a24f499318
introdue an abstraction for the name of the database so it can be changed via commandline parameter
dirk
parents:
diff
changeset
|
7 parser = ArgumentParser() |
91a24f499318
introdue an abstraction for the name of the database so it can be changed via commandline parameter
dirk
parents:
diff
changeset
|
8 parser.add_argument("--dbname", nargs="?", help="Name of the database") |
91a24f499318
introdue an abstraction for the name of the database so it can be changed via commandline parameter
dirk
parents:
diff
changeset
|
9 args = parser.parse_known_args() |
91a24f499318
introdue an abstraction for the name of the database so it can be changed via commandline parameter
dirk
parents:
diff
changeset
|
10 dbname = args[0].dbname |
91a24f499318
introdue an abstraction for the name of the database so it can be changed via commandline parameter
dirk
parents:
diff
changeset
|
11 if dbname is not None: |
91a24f499318
introdue an abstraction for the name of the database so it can be changed via commandline parameter
dirk
parents:
diff
changeset
|
12 database = dbname |
91a24f499318
introdue an abstraction for the name of the database so it can be changed via commandline parameter
dirk
parents:
diff
changeset
|
13 |
91a24f499318
introdue an abstraction for the name of the database so it can be changed via commandline parameter
dirk
parents:
diff
changeset
|
14 # |
91a24f499318
introdue an abstraction for the name of the database so it can be changed via commandline parameter
dirk
parents:
diff
changeset
|
15 # accessor methods for the various views |
91a24f499318
introdue an abstraction for the name of the database so it can be changed via commandline parameter
dirk
parents:
diff
changeset
|
16 # |
91a24f499318
introdue an abstraction for the name of the database so it can be changed via commandline parameter
dirk
parents:
diff
changeset
|
17 |
91a24f499318
introdue an abstraction for the name of the database so it can be changed via commandline parameter
dirk
parents:
diff
changeset
|
18 def feedEntriesByFeed(): |
91a24f499318
introdue an abstraction for the name of the database so it can be changed via commandline parameter
dirk
parents:
diff
changeset
|
19 return database + "/feedEntries_by_feed" |
91a24f499318
introdue an abstraction for the name of the database so it can be changed via commandline parameter
dirk
parents:
diff
changeset
|
20 |
91a24f499318
introdue an abstraction for the name of the database so it can be changed via commandline parameter
dirk
parents:
diff
changeset
|
21 def unreadFeedEntriesByFeed(): |
91a24f499318
introdue an abstraction for the name of the database so it can be changed via commandline parameter
dirk
parents:
diff
changeset
|
22 return database + "/unread_feedEntries_by_feed" |
91a24f499318
introdue an abstraction for the name of the database so it can be changed via commandline parameter
dirk
parents:
diff
changeset
|
23 |
91a24f499318
introdue an abstraction for the name of the database so it can be changed via commandline parameter
dirk
parents:
diff
changeset
|
24 def feeds(): |
91a24f499318
introdue an abstraction for the name of the database so it can be changed via commandline parameter
dirk
parents:
diff
changeset
|
25 return database + "/feeds" |
91a24f499318
introdue an abstraction for the name of the database so it can be changed via commandline parameter
dirk
parents:
diff
changeset
|
26 |
91a24f499318
introdue an abstraction for the name of the database so it can be changed via commandline parameter
dirk
parents:
diff
changeset
|
27 def feedEntryByLink(): |
91a24f499318
introdue an abstraction for the name of the database so it can be changed via commandline parameter
dirk
parents:
diff
changeset
|
28 return database + "/feedEntry_by_link" |
91a24f499318
introdue an abstraction for the name of the database so it can be changed via commandline parameter
dirk
parents:
diff
changeset
|
29 |
91a24f499318
introdue an abstraction for the name of the database so it can be changed via commandline parameter
dirk
parents:
diff
changeset
|
30 def preference(): |
91a24f499318
introdue an abstraction for the name of the database so it can be changed via commandline parameter
dirk
parents:
diff
changeset
|
31 return database + "/preference" |
91a24f499318
introdue an abstraction for the name of the database so it can be changed via commandline parameter
dirk
parents:
diff
changeset
|
32 |
91a24f499318
introdue an abstraction for the name of the database so it can be changed via commandline parameter
dirk
parents:
diff
changeset
|
33 |