Beispiel #1
0
def delete_feeds():
	feeds_id = request.forms.get('id').strip();

	result = False
	db = FeedsDb(config)
	result = db.delete_feeds(int(feeds_id))
	return {'result':result}
Beispiel #2
0
def feeds_detail(feeds_id):
	db = FeedsDb(config)
	title = db.fetch(feeds_id)
	rows = None
	if title:
		d = feedparser.parse(title[2])
		rows = d.entries

	feed_list=db.fetch_all_feeds()

	#db.addentries(rows)
	return template('index', t_rows = rows, t_feedlist = feed_list, t_feeds_id = feeds_id)
Beispiel #3
0
def add_feeds():
	result = True
	message = ""
	url = request.forms.get('url').strip()
	d = feedparser.parse(url)
	db = FeedsDb(config)
	#check exist?
	if db.fetch_by_url(url) > 0:
		result = False
		message = "Feeds has already added,add another one"
	else:
		result = db.addfeeds(d.feed.title,url)
		if result:
			message = "Feeds is added successfully"
		else:
			message = "Error happended when add Feeds"
	return {'result':result,'message':message}
Beispiel #4
0
def get_list():
	db = FeedsDb(config)
	feed_list=db.fetch_all_feeds()
	return template('list', t_feedlist = feed_list)