コード例 #1
0
def displayPost(postObj, titleTag, bodyTag, userTag, commentTag):
    postResult = ""
    postResult +=  stdStuff.makeTag(userTag, postObj.id) + \
        stdStuff.makeTag(userTag, postObj.user) + \
        stdStuff.makeTag(titleTag, postObj.title) + \
        stdStuff.makeTag(bodyTag, postObj.text)
    postResult += "<br><h6>Comments</h6><br>"
    postResult += displayComments(postObj.comments, userTag, commentTag)

    postResult += '''<br>
<br>
<br>
<br>
<form action = "postExpanded.py" method = "GET">
Text: <textarea name="comment" rows="10" cols="15">
</textarea>
<br>
<input type = "submit" name="done" value = "done">
</form>'''

    return postResult
コード例 #2
0
def displayPost(postObj, titleTag, bodyTag, userTag, commentTag):
	postResult = ""
	postResult += 	stdStuff.makeTag(userTag, postObj.id) + \
					stdStuff.makeTag(userTag, postObj.user) + \
					stdStuff.makeTag(titleTag, postObj.title) + \
					stdStuff.makeTag(bodyTag, postObj.text)
	postResult += "<br><h6>Comments</h6><br>"
	postResult += displayComments(postObj.comments, userTag, commentTag)
	
	postResult += '''<br>
<br>
<br>
<br>
<form action = "postExpanded.py" method = "GET">
Text: <textarea name="comment" rows="10" cols="15">
</textarea>
<br>
<input type = "submit" name="done" value = "done">
</form>'''
	
	return postResult
コード例 #3
0
def displayPost(titleTag, bodyTag, userTag, commentTag=""):
	postStream = open(stdStuff.directory + stdStuff.postFile, "r")
	allPosts = postStream.read()
	postStream.close()

	listOfPosts = allPosts.split(stdStuff.splitPost)
	listOfPosts.pop()
	
	postResult = ""
	if len(allPosts) > 0:
			for post in listOfPosts:
				listTemp = post.split(stdStuff.splitChar)
				
				if not(postID == listTemp[0]):
					continue
				postResult += stdStuff.makeTag(userTag, listTemp[0])
				postResult += stdStuff.makeTag(userTag, listTemp[1])
				postResult += stdStuff.makeTag(titleTag, listTemp[2])
				postResult += stdStuff.makeTag(bodyTag, listTemp[3])
				
				return postResult
コード例 #4
0
def displayPost(titleTag, bodyTag, userTag, commentTag=""):
    postStream = open(stdStuff.directory + stdStuff.postFile, "r")
    allPosts = postStream.read()
    postStream.close()

    listOfPosts = allPosts.split(stdStuff.splitPost)
    listOfPosts.pop()

    postResult = ""
    if len(allPosts) > 0:
        for post in listOfPosts:
            listTemp = post.split(stdStuff.splitChar)

            if not (postID == listTemp[0]):
                continue
            postResult += stdStuff.makeTag(userTag, listTemp[0])
            postResult += stdStuff.makeTag(userTag, listTemp[1])
            postResult += stdStuff.makeTag(titleTag, listTemp[2])
            postResult += stdStuff.makeTag(bodyTag, listTemp[3])

            return postResult
コード例 #5
0
def displayMessageAndReplies(userDict, currentUser, postId):
    res = ""

    #stores the "from: user" and message
    messagePairings = {}
    for message in userDict[currentUser].inbox.messages:
        if message.id == postId:
            res += stdStuff.makeTag("h6", message.id)
            res += stdStuff.makeTag("h2", message.title)

            for reply in message.replies:
                res += stdStuff.makeTag("h6", "From: " + reply.srcUser)
                res += stdStuff.makeTag("p", reply.text)
                res += "<br>"

            res += '''<form action = "messageChain.py" method = "GET">
Reply: <textarea name="replyBody" rows="10" cols="15">
</textarea>
<br>
<input name="postId" type="hidden" value="''' + str(message.id) + '''">
<input name="reply" type="submit" value="Reply">
</form>'''

    return res
コード例 #6
0
def displayMessageAndReplies(userDict, currentUser, postId):
	res = ""
	
	#stores the "from: user" and message
	messagePairings = {}
	for message in userDict[currentUser].inbox.messages:
		if message.id == postId:
			res += stdStuff.makeTag("h6", message.id)
			res += stdStuff.makeTag("h2", message.title)
			
			for reply in message.replies:
				res += stdStuff.makeTag("h6", "From: " + reply.srcUser)
				res += stdStuff.makeTag("p", reply.text)
				res += "<br>"
			
			res += '''<form action = "messageChain.py" method = "GET">
Reply: <textarea name="replyBody" rows="10" cols="15">
</textarea>
<br>
<input name="postId" type="hidden" value="''' + str(message.id) + '''">
<input name="reply" type="submit" value="Reply">
</form>'''
	
	return res
コード例 #7
0
def displayComments(commentList, userTag, bodyTag):
    res = ""
    for comment in commentList:
        res +=  stdStuff.makeTag(userTag, comment.user) + \
          stdStuff.makeTag(bodyTag, comment.text)
    return res
コード例 #8
0
def displayComments(commentList, userTag, bodyTag):
	res = ""
	for comment in commentList:
		res += 	stdStuff.makeTag(userTag, comment.user) + \
				stdStuff.makeTag(bodyTag, comment.text)
	return res