Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

20 lines (18 sloc) 0.572 kb
import urllib
import re
import web
from web import session
from redis import Redis
clean_url = re.compile('^(feed://)')
r = Redis()
class Feed(object):
def add(self,url):
url = clean_url.sub("http://",url)
if not r.exists("url:" + str(url) + ":fid"):
feed_id = r.incr("global:nextFeedId")
r.set("fid:" + str(feed_id) + ":url",url)
r.set("url:" + url + ":fid",feed_id)
r.push("global:feeds",feed_id)
r.set("uid:" + str(session.user_id) + ":feeds",feed_id)
r.set("fid:" + str(feed_id) + ":uid",session.user_id)
return True
Jump to Line
Something went wrong with that request. Please try again.