Exemplo n.º 1
0
def writeComment(targId, currentUser, commentText):
    userDict = stdStuff.objFileToList(stdStuff.directory,
                                      stdStuff.userFile,
                                      byName=True)
    counter = stdStuff.getCounter()

    for post in userDict[currentUser].posts:
        if post.id == targId:
            post.addComment(counter, currentUser, commentText)
            stdStuff.objListToFile(userDict,
                                   stdStuff.directory,
                                   stdStuff.userFile,
                                   isDict=True)
            stdStuff.setCounter(counter)
            return

    for friend in userDict[currentUser].friends:
        for post in userDict[friend].posts:
            if post.id == targId:
                post.addComment(counter, currentUser, commentText)
                stdStuff.objListToFile(userDict,
                                       stdStuff.directory,
                                       stdStuff.userFile,
                                       isDict=True)
                stdStuff.setCounter(counter)
                return
Exemplo n.º 2
0
def writeComment(targId, cookie, commentText):
    targName = cookie["username"].value
    allUsers = stdStuff.objFileToList(stdStuff.directory, stdStuff.userFile)
    counter = stdStuff.getCounter()

    for index, value in enumerate(allUsers):
        if value.name == targName:
            for index2, value2 in enumerate(value.posts):
                if int(value2.id) == int(targId):
                    value.posts[index2].addComment(counter, targName, commentText)
    stdStuff.objListToFile(allUsers, stdStuff.directory, stdStuff.userFile)
    stdStuff.setCounter(counter)
def writeComment(targId, cookie, commentText):
    targName = cookie["username"].value
    allUsers = stdStuff.objFileToList(stdStuff.directory, stdStuff.userFile)
    counter = stdStuff.getCounter()

    for index, value in enumerate(allUsers):
        if value.name == targName:
            for index2, value2 in enumerate(value.posts):
                if int(value2.id) == int(targId):
                    value.posts[index2].addComment(counter, targName,
                                                   commentText)
    stdStuff.objListToFile(allUsers, stdStuff.directory, stdStuff.userFile)
    stdStuff.setCounter(counter)
def writeComment(targId, cookie, commentText):
    targName = currentGroup
    currentUser = c['username'].value
    groupList = stdStuff.objFileToList(stdStuff.directory, stdStuff.groupFile)
    counter = stdStuff.getCounter()

    for index, value in enumerate(groupList):
        if value.name == targName:
            for index2, value2 in enumerate(value.posts):
                if int(value2.id) == int(targId):
                    value.posts[index2].addComment(counter, currentUser,
                                                   commentText)
    stdStuff.objListToFile(groupList, stdStuff.directory, stdStuff.groupFile)
    stdStuff.setCounter(counter)
Exemplo n.º 5
0
def writeComment(targId, cookie, commentText):
	targName = currentGroup
	currentUser = c['username'].value
	groupList = stdStuff.objFileToList(stdStuff.directory,
										 stdStuff.groupFile)
	counter = stdStuff.getCounter()
	
	for index, value in enumerate(groupList):
		if value.name == targName:
			for index2, value2 in enumerate(value.posts):
				if int(value2.id) == int(targId):
					value.posts[index2].addComment(counter, currentUser, commentText)
	stdStuff.objListToFile(groupList, stdStuff.directory, stdStuff.groupFile)
	stdStuff.setCounter(counter)
Exemplo n.º 6
0
def writePost(cookie, formThing):
    counter = stdStuff.getCounter()

    userList = stdStuff.objFileToList(stdStuff.directory, stdStuff.userFile)

    for x in userList:
        if x.name == cookie["username"].value:
            x.addPost(
                stdStuff.Post(counter, cookie["username"].value,
                              formThing.getvalue("postTitle"),
                              formThing.getvalue('textBody')))
            break

    stdStuff.setCounter(counter)
    stdStuff.objListToFile(userList, stdStuff.directory, stdStuff.userFile)
Exemplo n.º 7
0
def writePost(cookie, formThing):
	counter = stdStuff.getCounter()
	
	userList = stdStuff.objFileToList(stdStuff.directory, stdStuff.userFile)
	
	for x in userList:
		if x.name == cookie["username"].value:
			x.addPost(stdStuff.Post(
					counter, 
					cookie["username"].value,
					stdStuff.deleteBrackets(formThing.getvalue("postTitle")),
					stdStuff.deleteBrackets(formThing.getvalue('textBody'))))
			break
	
	stdStuff.setCounter(counter)
	stdStuff.objListToFile(userList, stdStuff.directory, stdStuff.userFile)
def writePost(cookie, formThing):
    counter = stdStuff.getCounter()

    groupList = stdStuff.objFileToList(stdStuff.directory, stdStuff.groupFile)

    for x in groupList:
        if x.name == currentGroup:
            x.addPost(
                stdStuff.Post(
                    counter, cookie["username"].value,
                    stdStuff.deleteBrackets(formThing.getvalue("postTitle")),
                    stdStuff.deleteBrackets(formThing.getvalue('textBody'))))
            break

    stdStuff.setCounter(counter)
    stdStuff.objListToFile(groupList, stdStuff.directory, stdStuff.groupFile)
Exemplo n.º 9
0
def writePost(cookie, formThing):
	counter = stdStuff.getCounter()
	
	groupList = stdStuff.objFileToList(stdStuff.directory, stdStuff.groupFile)
	
	for x in groupList:
		if x.name == currentGroup:
			x.addPost( stdStuff.Post(
							counter, 
							cookie["username"].value,
							formThing.getvalue("postTitle"),
							formThing.getvalue('textBody')))
			break
	
	stdStuff.setCounter(counter)
	stdStuff.objListToFile(groupList, stdStuff.directory, stdStuff.groupFile)
Exemplo n.º 10
0
def writeComment(targId, currentUser, commentText):
	userDict = stdStuff.objFileToList(stdStuff.directory,
										 stdStuff.userFile, byName=True)
	counter = stdStuff.getCounter()
	
	for post in userDict[currentUser].posts:
		if post.id == targId:
			post.addComment(counter, currentUser, commentText)
			stdStuff.objListToFile(userDict, stdStuff.directory,
							stdStuff.userFile, isDict=True)
			stdStuff.setCounter(counter)
			return
	
	for friend in userDict[currentUser].friends:
		for post in userDict[friend].posts:
			if post.id == targId:
				post.addComment(counter, currentUser, commentText)
				stdStuff.objListToFile(userDict, stdStuff.directory,
								stdStuff.userFile, isDict=True)
				stdStuff.setCounter(counter)
				return