comparison backend/couchdb/Preferences.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 e8bb107a74e1
children 214addba1f93
comparison
equal deleted inserted replaced
168:f4708d38419c 169:91a24f499318
1
2 import CouchDb
1 3
2 DAYS_TO_KEEP_FEED_ENTRIES = "daysToKeepFeedEntries" 4 DAYS_TO_KEEP_FEED_ENTRIES = "daysToKeepFeedEntries"
3 HIDE_READ_FEED_ENTRIES = "hideReadFeedEntries" 5 HIDE_READ_FEED_ENTRIES = "hideReadFeedEntries"
4 PROXY_HOST = "proxyHost" 6 PROXY_HOST = "proxyHost"
5 PROXY_PORT = "proxyPort" 7 PROXY_PORT = "proxyPort"
11 self.database = database 13 self.database = database
12 self._initDocument() 14 self._initDocument()
13 self.documentIsDirty = False 15 self.documentIsDirty = False
14 16
15 def _initDocument(self): 17 def _initDocument(self):
16 viewResults = self.database.view("feedtest/preference") 18 viewResults = self.database.view(CouchDb.preference())
17 try: 19 try:
18 row = iter(viewResults).next() 20 row = iter(viewResults).next()
19 self.document = self.database[row.id] 21 self.document = self.database[row.id]
20 except StopIteration: 22 except StopIteration:
21 empty = { "doctype" : "preferences" } 23 empty = { "doctype" : "preferences" }