def test_getPostNoCT(): for boardName in board.getBoards(): l = boardDIR.getPostsList( boardName ) for thePost in l: filename = thePost["filename"] content = post.getPostNoCT(boardName,filename) assert not re.search('\\033\[[0-9;]*[a-zA-Z]',content) assert type(content) == str
def test_getPostNoCT(): for boardName in board.getBoards(): l = boardDIR.getPostsList(boardName) for thePost in l: filename = thePost["filename"] content = post.getPostNoCT(boardName, filename) assert not re.search('\\033\[[0-9;]*[a-zA-Z]', content) assert type(content) == str
def GET(self): web.header('content-type','text/json;charset=utf-8',unique=True) if not checkPasswd(): return "Not Logged In" start = ("start" in web.input() and int(web.input()["start"]) or 1) cnt = ("cnt" in web.input() and web.input()["cnt"] or 20) b = web.input()["board"] boardPostsLists = board.getPostsList(b) l = [] for i in range(start-1,start+cnt-1): if i >= len(boardPostsLists): break t = {} t["filename"] = boardPostsLists[i]["filename"][:14] t["No"] = i+1 t["title"] = boardPostsLists[i]["title"] t["owner"] = boardPostsLists[i]["owner"] t["id"] = boardPostsLists[i]["id"] t["reid"] = boardPostsLists[i]["reid"] t["content"] = functions.GBK2UTF(post.getPostNoCT(b,t["filename"])) l.append(t) if len(l) == 0: return str(len(boardPostsLists)+1) return json2.write(l)