annotate backend/couchdb/CouchDb.py @ 176:7001070d0bd5

clean code
author dirk
date Fri, 09 Sep 2011 18:19:01 +0200
parents 57e324fa4350
children e8cc86981938
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
174
d0ced79b5030 implement expiring read feed entries
dirk
parents: 169
diff changeset
33 def readFeedEntriesByCreateDate():
d0ced79b5030 implement expiring read feed entries
dirk
parents: 169
diff changeset
34 return database + "/read_feedEntries_by_create_date"
169
91a24f499318 introdue an abstraction for the name of the database so it can be changed via commandline parameter
dirk
parents:
diff changeset
35
175
57e324fa4350 implement getting a list of feeds that have unread entries
dirk
parents: 174
diff changeset
36 def feedsWithUnreadEntries():
57e324fa4350 implement getting a list of feeds that have unread entries
dirk
parents: 174
diff changeset
37 return database + "/feeds_with_unread_entries"