Mercurial > hg > Feedworm
annotate backend/couchdb/CouchDbBackend.py @ 139:2cd30af937fa
add the required methods for determining if a feed needs to be updated
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Tue, 23 Aug 2011 16:02:35 +0200 |
parents | 9e1e6b96d8b0 |
children | 74217db92993 |
rev | line source |
---|---|
132
63d6d60d37ff
new backend for using CouchDB as persistence mechanism ... currently all methods are unimplemented
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
1 |
133
9e1e6b96d8b0
implement proxyHost/proxyPort in Preferences
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
132
diff
changeset
|
2 from Preferences import Preferences |
139
2cd30af937fa
add the required methods for determining if a feed needs to be updated
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
133
diff
changeset
|
3 from backend.couchdb.Feed import Feed |
132
63d6d60d37ff
new backend for using CouchDB as persistence mechanism ... currently all methods are unimplemented
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
4 import couchdb |
63d6d60d37ff
new backend for using CouchDB as persistence mechanism ... currently all methods are unimplemented
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
5 |
139
2cd30af937fa
add the required methods for determining if a feed needs to be updated
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
133
diff
changeset
|
6 |
133
9e1e6b96d8b0
implement proxyHost/proxyPort in Preferences
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
132
diff
changeset
|
7 DATABASE = "feedtest" |
9e1e6b96d8b0
implement proxyHost/proxyPort in Preferences
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
132
diff
changeset
|
8 |
132
63d6d60d37ff
new backend for using CouchDB as persistence mechanism ... currently all methods are unimplemented
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
9 class CouchDbBackend(object): |
63d6d60d37ff
new backend for using CouchDB as persistence mechanism ... currently all methods are unimplemented
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
10 ''' |
63d6d60d37ff
new backend for using CouchDB as persistence mechanism ... currently all methods are unimplemented
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
11 Backend that uses CouchDB for persistence |
63d6d60d37ff
new backend for using CouchDB as persistence mechanism ... currently all methods are unimplemented
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
12 ''' |
63d6d60d37ff
new backend for using CouchDB as persistence mechanism ... currently all methods are unimplemented
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
13 |
63d6d60d37ff
new backend for using CouchDB as persistence mechanism ... currently all methods are unimplemented
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
14 def __init__(self): |
63d6d60d37ff
new backend for using CouchDB as persistence mechanism ... currently all methods are unimplemented
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
15 server = couchdb.Server() |
133
9e1e6b96d8b0
implement proxyHost/proxyPort in Preferences
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
132
diff
changeset
|
16 self.database = server[DATABASE] |
132
63d6d60d37ff
new backend for using CouchDB as persistence mechanism ... currently all methods are unimplemented
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
17 |
63d6d60d37ff
new backend for using CouchDB as persistence mechanism ... currently all methods are unimplemented
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
18 def preferences(self): |
133
9e1e6b96d8b0
implement proxyHost/proxyPort in Preferences
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
132
diff
changeset
|
19 return Preferences(self.database) |
132
63d6d60d37ff
new backend for using CouchDB as persistence mechanism ... currently all methods are unimplemented
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
20 |
63d6d60d37ff
new backend for using CouchDB as persistence mechanism ... currently all methods are unimplemented
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
21 def getFeeds(self): |
63d6d60d37ff
new backend for using CouchDB as persistence mechanism ... currently all methods are unimplemented
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
22 raise Exception("not yet implemented") |
63d6d60d37ff
new backend for using CouchDB as persistence mechanism ... currently all methods are unimplemented
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
23 |
63d6d60d37ff
new backend for using CouchDB as persistence mechanism ... currently all methods are unimplemented
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
24 def toggleRead(self, feedEntry): |
63d6d60d37ff
new backend for using CouchDB as persistence mechanism ... currently all methods are unimplemented
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
25 raise Exception("not yet implemented") |
63d6d60d37ff
new backend for using CouchDB as persistence mechanism ... currently all methods are unimplemented
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
26 |
63d6d60d37ff
new backend for using CouchDB as persistence mechanism ... currently all methods are unimplemented
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
27 def markAllEntriesRead(self, feed): |
63d6d60d37ff
new backend for using CouchDB as persistence mechanism ... currently all methods are unimplemented
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
28 raise Exception("not yet implemented") |
63d6d60d37ff
new backend for using CouchDB as persistence mechanism ... currently all methods are unimplemented
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
29 |
63d6d60d37ff
new backend for using CouchDB as persistence mechanism ... currently all methods are unimplemented
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
30 def createFeed(self, url): |
63d6d60d37ff
new backend for using CouchDB as persistence mechanism ... currently all methods are unimplemented
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
31 raise Exception("not yet implemented") |
63d6d60d37ff
new backend for using CouchDB as persistence mechanism ... currently all methods are unimplemented
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
32 |
63d6d60d37ff
new backend for using CouchDB as persistence mechanism ... currently all methods are unimplemented
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
33 def updateFeed(self, feed, changes): |
63d6d60d37ff
new backend for using CouchDB as persistence mechanism ... currently all methods are unimplemented
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
34 raise Exception("not yet implemented") |
63d6d60d37ff
new backend for using CouchDB as persistence mechanism ... currently all methods are unimplemented
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
35 |
63d6d60d37ff
new backend for using CouchDB as persistence mechanism ... currently all methods are unimplemented
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
36 def deleteFeed(self, feed): |
63d6d60d37ff
new backend for using CouchDB as persistence mechanism ... currently all methods are unimplemented
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
37 raise Exception("not yet implemented") |
63d6d60d37ff
new backend for using CouchDB as persistence mechanism ... currently all methods are unimplemented
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
38 |
63d6d60d37ff
new backend for using CouchDB as persistence mechanism ... currently all methods are unimplemented
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
39 def markFeedEntriesAsRead(self, entries): |
63d6d60d37ff
new backend for using CouchDB as persistence mechanism ... currently all methods are unimplemented
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
40 raise Exception("not yet implemented") |
63d6d60d37ff
new backend for using CouchDB as persistence mechanism ... currently all methods are unimplemented
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
41 |
63d6d60d37ff
new backend for using CouchDB as persistence mechanism ... currently all methods are unimplemented
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
42 def updateAllFeeds(self): |
139
2cd30af937fa
add the required methods for determining if a feed needs to be updated
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
133
diff
changeset
|
43 # TODO use a view instead of iterating all feeds |
2cd30af937fa
add the required methods for determining if a feed needs to be updated
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
133
diff
changeset
|
44 allFeeds = Feed.all(self.database) |
2cd30af937fa
add the required methods for determining if a feed needs to be updated
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
133
diff
changeset
|
45 for feed in allFeeds: |
2cd30af937fa
add the required methods for determining if a feed needs to be updated
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
133
diff
changeset
|
46 if feed.needsUpdate(): |
2cd30af937fa
add the required methods for determining if a feed needs to be updated
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
133
diff
changeset
|
47 print("feed needs update " + str(feed)) |
132
63d6d60d37ff
new backend for using CouchDB as persistence mechanism ... currently all methods are unimplemented
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
48 |
63d6d60d37ff
new backend for using CouchDB as persistence mechanism ... currently all methods are unimplemented
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
49 def expireFeedEntries(self): |
139
2cd30af937fa
add the required methods for determining if a feed needs to be updated
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
133
diff
changeset
|
50 print("Expiring feeds is not yet implemented") |
2cd30af937fa
add the required methods for determining if a feed needs to be updated
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
133
diff
changeset
|
51 # raise Exception("not yet implemented") |
132
63d6d60d37ff
new backend for using CouchDB as persistence mechanism ... currently all methods are unimplemented
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
52 |
63d6d60d37ff
new backend for using CouchDB as persistence mechanism ... currently all methods are unimplemented
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
53 def dispose(self): |
63d6d60d37ff
new backend for using CouchDB as persistence mechanism ... currently all methods are unimplemented
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
54 # nothing to do here |
63d6d60d37ff
new backend for using CouchDB as persistence mechanism ... currently all methods are unimplemented
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
55 pass |