Пример #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
Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #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