Exemplo n.º 1
0
 def setUp(self):
     super(TestHeap, self).setUp()
     self.threads = set()
     self.content_stream = []
     self.content_counter = 0
     self.forum = forum.forum(self.feed)
     heap.priority_list(self.forum, lambda x: analyze.evaluate(x))
     heap.priority_list(self.forum, lambda x: -analyze.evaluate(x))
Exemplo n.º 2
0
@app.route('/read/thread_day')
def read_next_day():
	forum_list[forum_index].get_next_day()
	return redirect('/')

@app.route('/thread/<int:thread_id>')
def thread_page(thread_id):
	posts = [make_ascii(p.text) for p in forum_list[forum_index].thread_list[int(thread_id)].post_list()]
	return render_template('thread.html', posts=posts)

def make_ascii(text):
	return Markup(filter(lambda x: x in string.printable, text))

if __name__ == '__main__':
	forum_list.append(forum(feed('OnlineGames')))
	forum_list.append(forum(feed('OnlineGames2')))
	forum_list.append(forum(feed('Nutrition')))
	forum_list.append(forum(feed('Nutrition2')))
	forum_list.append(forum(feed('Innovation')))
	forum_list.append(forum(feed('Innovation2')))
	forum_list.append(forum(feed('POSA')))
	forum_list.append(forum(feed('POSA2')))
	for f in forum_list:
		heap.priority_list(f, analyze.evaluate, 'default')
		heap.priority_list(f, analyze.question_marks, 'question_marks')
		heap.priority_list(f, analyze.question_words, 'question_words')
		heap.priority_list(f, analyze.social_words, 'social_words')
		f.get_next_day()
	app.run(debug=True, host='0.0.0.0')
	
Exemplo n.º 3
0
import json

from flask import jsonify

from forum import forum
from threadConversation import threadConversation
from db import db
from post import post

from commonUtility import commonUtility
from appUtility import appUtility

dbPath = 'proj1.db'

x = forum()
x.name = "test"
x.creator = "ddsd"

xlist = [x]

#db.executeInsert('proj1.db', x)
#print(json.dumps([i.serializeItem() for i in xlist]))

y = post()
y.thread_id = 90
y.text1 = "weereredsf"
#print(db.getExistQuery(x, ["name", "creator"]))

#print(db.getSelectQuery(forum, {"name":"testerdsfds", "creator":"maymay"}))
#print(db.getSelectQuery(post, {"thread_id":7878, "title":"223k432jl"}))
#print(db.getSelectQuery(post, {}))