本文整理汇总了Python中stdStuff.objFileToList函数的典型用法代码示例。如果您正苦于以下问题:Python objFileToList函数的具体用法?Python objFileToList怎么用?Python objFileToList使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了objFileToList函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: createNotMember
def createNotMember():
notMember = ''
groupList = stdStuff.objFileToList(stdStuff.directory, stdStuff.groupFile)
for group in groupList:
if group.name == currentGroup:
userList = stdStuff.objFileToList(stdStuff.directory,
stdStuff.userFile)
for member in userList:
if not(member.name in group.members):
notMember += '<option>' + (member.name) + '</option?> \n\t'
return notMember
开发者ID:wertylop5,项目名称:stuy-intro2-sites,代码行数:11,代码来源:groupsPage.py
示例2: createIsMember
def createIsMember():
isMember = ''
groupList = stdStuff.objFileToList(stdStuff.directory, stdStuff.groupFile)
for group in groupList:
if group.name == currentGroup:
userList = stdStuff.objFileToList(stdStuff.directory,
stdStuff.userFile)
for member in userList:
if (member.name in group.members) and (member.name != currentUser):
isMember += '<option>' + (member.name) + '</option> \n\t'
return isMember
开发者ID:wertylop5,项目名称:stuy-intro2-sites,代码行数:11,代码来源:groupsPage.py
示例3: makePage
def makePage(cookie):
res = str(poster())
userList = stdStuff.objFileToList(stdStuff.directory, stdStuff.userFile)
for x in userList:
if x.name == cookie["username"].value:
for post in x.posts:
res += """<table>
<tr>
<td>""" + str(post.score) + """</td>
<td>
"""
res += post.display()
res += "<a href='profile.py?downVote=lol&postId="+\
str(post.id) + "'>Down Vote</a><br>"
res += "<a href='profile.py?upVote=lol&postId="+\
str(post.id) + "'>Up Vote</a><br>"
res += """<a href='postExpanded.py?expandButton=""" + \
str(post.id) + "'>Comment </a>"
res += """</td>
</tr>
</table>
"""
break
return res
开发者ID:wertylop5,项目名称:stuy-intro2-sites,代码行数:30,代码来源:profile.py
示例4: displayPost
def displayPost(id, cookie, titleTag, bodyTag, userTag, commentTag):
res = ""
userList = stdStuff.objFileToList(stdStuff.directory, stdStuff.userFile)
for x in userList:
if x.name == cookie["username"].value:
for post in x.posts:
if post.id == id:
res += post.display()
res += "<br><h3>Comments</h3><br>"
for comment in post.comments:
res += """<table>
<tr>
<td>""" + str(comment.score) + """</td>
<td>
"""
res += comment.display()
res += "<a href='postExpanded.py?downVote=lol&commentId="+\
str(comment.id) + "'&postId='" + str(post.id) + "'>Down Vote</a><br>"
res += "<a href='postExpanded.py?upVote=lol&commentId="+\
str(comment.id) + "'&postId='" + str(post.id) + "'>Up Vote</a><br>"
res += """</td>
</tr>
</table>
"""
break
return res
开发者ID:wertylop5,项目名称:stuy-intro2-sites,代码行数:32,代码来源:postExpanded.py
示例5: displayGroup
def displayGroup():
availableGroups = ''
groupList = stdStuff.objFileToList(stdStuff.directory, stdStuff.groupFile)
for name in groupList:
if (name.visibility == 'public') or (currentUser in name.members):
availableGroups += '<option>' + str(name.name) + '</option>'
return availableGroups
开发者ID:wertylop5,项目名称:stuy-intro2-sites,代码行数:7,代码来源:groups.py
示例6: displayUnreadMessages
def displayUnreadMessages(cookie):
res = "<br>"
orderedMessages = []
#friend requests
orderedRequests = []
currentUser = cookie["username"].value
userDict = stdStuff.objFileToList(stdStuff.directory,
stdStuff.userFile, byName=True)
res += \
"""<a href='inbox.py?markRead=all&unread=hey'>Mark all as read</a><br><br>"""
for message in userDict[currentUser].inbox.messages:
if type(message) is stdStuff.Message:
orderedMessages.append(message)
elif type(message) is stdStuff.FriendRequest:
orderedRequests.append(message)
orderedMessages.sort(key=lambda x: x.id, reverse=True)
orderedRequests.sort(key=lambda x: x.id, reverse=True)
for request in orderedRequests:
if request.viewed == False:
res += request.display()
res += "<a href='inbox.py?aReq=" + str(request.id) + \
"&unread=hey'>Accept</a><br>"
res += "<a href='inbox.py?dReq=" + str(request.id) + \
"&unread=hey'>Decline</a>"
for message in orderedMessages:
if message.viewed == False:
res += message.display()
res += "<a href='inbox.py?markRead=" + str(message.id) + \
"&unread=hey'>Mark as read</a>"
return res
开发者ID:wertylop5,项目名称:stuy-intro2-sites,代码行数:33,代码来源:inbox.py
示例7: displayReadMessages
def displayReadMessages(cookie):
res = ""
orderedMessages = []
currentUser = cookie["username"].value
userDict = stdStuff.objFileToList(stdStuff.directory,
stdStuff.userFile, byName=True)
res += \
"<a href='inbox.py?markUnread=all&read=hey'>Mark all as unread</a><br><br>"
for message in userDict[currentUser].inbox.messages:
if type(message) is stdStuff.Message:
orderedMessages.append(message)
orderedMessages.sort(key=lambda x: x.id, reverse=True)
for message in orderedMessages:
if message.viewed == True:
res += "<div class='message'>"
res += message.display()
res += "<a href='messageChain.py?postId=" + \
str(message.id) + "'>View all replies</a>"
res += "<br>"
res += "<a href='inbox.py?markUnread=" + \
str(message.id) + \
"&read=hey'>Mark as unread</a>"
res += '''<form action = "inbox.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>
</div>'''
#res += "</div>"
return res
开发者ID:wertylop5,项目名称:stuy-intro2-sites,代码行数:34,代码来源:inbox.py
示例8: writeComment
def writeComment(commentText, cookie, targId):
allPosts = stdStuff.objFileToList(stdStuff.directory,
stdStuff.postFile)
for index, value in enumerate(allPosts):
if value.id == targId:
allPosts[index].addComment(cookie['username'].value,
commentText)
commentWStream = open(stdStuff.directory + stdStuff.postFile, "w")
for x in allPosts:
pickle.dump(x, commentWStream)
commentWStream.close()
开发者ID:wertylop5,项目名称:stuy-intro2-sites,代码行数:11,代码来源:postExpanded.py
示例9: writeComment
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)
开发者ID:wertylop5,项目名称:stuy-intro2-sites,代码行数:14,代码来源:groupExpanded.py
示例10: sendFriendRequest
def sendFriendRequest(form, userDict, srcUser):
res = "<h4>Request sent to: "
atLeastOne = False
for element in form:
if element in userDict:
# send the friend request
userDict[srcUser].inbox.sendMessage(element, "", "", request=True)
atLeastOne = True
res += element + ", "
res = res[: len(res) - 2]
res += "</h4>"
if not (atLeastOne):
res = "<h2>You didn't select anyone!</h2>"
userDict = stdStuff.objFileToList(stdStuff.directory, stdStuff.userFile, byName=True)
return res
开发者ID:wertylop5,项目名称:stuy-intro2-sites,代码行数:15,代码来源:addFriend.py
示例11: displayGroupWidget
def displayGroupWidget(cookie):
currentUser = cookie["username"].value
userDict = stdStuff.objFileToList(stdStuff.directory, stdStuff.userFile, byName=True)
res = """
<div align='right'>
<table border='1'>
<tr>
<td>
<a href="groups.py">View groups</a>
</td>
</tr>
</table>
</div>
"""
return res
开发者ID:wertylop5,项目名称:stuy-intro2-sites,代码行数:16,代码来源:addFriend.py
示例12: displayInboxWidget
def displayInboxWidget(cookie):
currentUser = cookie["username"].value
userDict = stdStuff.objFileToList(stdStuff.directory, stdStuff.userFile, byName=True)
res = """
<div class="widget" id="inboxWidget">
<table border='1'>
<tr>
<td>
<a href="inbox.py">View messages</a>
</td>
</tr>
</table>
</div>
"""
return res
开发者ID:wertylop5,项目名称:stuy-intro2-sites,代码行数:16,代码来源:profile.py
示例13: writePost
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)
开发者ID:wertylop5,项目名称:stuy-intro2-sites,代码行数:16,代码来源:profile.py
示例14: writePost
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)
开发者ID:wertylop5,项目名称:stuy-intro2-sites,代码行数:16,代码来源:groupsPage.py
示例15: displayPosts
def displayPosts(cookie):
currentUser = cookie["username"].value
res = ""
#will sort
totalPosts = []
#all users in system
userDict = stdStuff.objFileToList(stdStuff.directory,
stdStuff.userFile, byName=True)
totalPosts.extend(userDict[currentUser].posts[:])
#remember, the friends array only holds names
for friend in userDict[currentUser].friends:
totalPosts.extend(userDict[friend].posts[:])
totalPosts.sort(key=lambda x: x.id, reverse=True)
for post in totalPosts:
res += """<table>
<tr>
<td>""" + str(post.score) + """</td>
<td>
"""
res += post.display()
res += "<a href='profile.py?downVote=lol&postId="+\
str(post.id) + "'>Down Vote</a><br>"
res += "<a href='profile.py?upVote=lol&postId="+\
str(post.id) + "'>Up Vote</a><br>"
res += "<a href='profile.py?removeVote=lol&postId="+\
str(post.id) + "'>Remove Vote</a><br>"
res += """<a href='postExpanded.py?expandButton=""" + \
str(post.id) + "'>Comment </a>"
res += """</td>
</tr>
</table>
"""
return res
开发者ID:wertylop5,项目名称:stuy-intro2-sites,代码行数:43,代码来源:profile.py
示例16:
head = \
'''
<!DOCTYPE html>
<html>
<head><title>Profile</title>
</head>
<body>
'''
body = ""
foot = \
'''
</body>
</html>
'''
thing = stdStuff.objFileToList(stdStuff.directory, stdStuff.userFile)
for user in thing:
print user.displayPosts()
print head
print body
print foot
开发者ID:wertylop5,项目名称:stuy-intro2-sites,代码行数:29,代码来源:testfile.py
示例17: open
form = cgi.FieldStorage()
body = ''
foot = '''</body>
<html>'''
#print currentGroup
f = open(directory + stdStuff.groupFile, 'r')
groupList = f.read()
f.close()
userDict = stdStuff.objFileToList(stdStuff.directory,
stdStuff.userFile, byName=True)
groupDict = stdStuff.objFileToList(stdStuff.directory,
stdStuff.groupFile, byName=True)
userList = stdStuff.objFileToList(stdStuff.directory,
stdStuff.userFile)
groupList = stdStuff.objFileToList(stdStuff.directory, stdStuff.groupFile)
def authenticate(u,ID,IP):
loggedIn = open(stdStuff.directory + stdStuff.logFile,'r').read().split('\n')
loggedIn = [each.split(',') for each in loggedIn]
loggedIn.remove([''])
for a in loggedIn:
if a[0] == username:
return a[1]==str(ID) and a[2]==IP
return False
开发者ID:wertylop5,项目名称:stuy-intro2-sites,代码行数:30,代码来源:groupsPage.py
示例18: displayPost
def displayPost(id, cookie, titleTag, bodyTag, userTag, commentTag):
res = ""
groupList = stdStuff.objFileToList(stdStuff.directory,
stdStuff.groupFile)
for x in groupList:
if (x.name == currentGroup):
for post in x.posts:
if post.id == id:
res += "<div id='post'>"
res += post.display()
res += "<br><h3>Comments</h3><br>"
for comment in post.comments:
res += """<table class="comment">
<tr>
<td>""" + str(comment.score) + """</td>
<td>
"""
res += comment.display()
res += "<a href='groupExpanded.py?downVote=lol&commentId="+\
str(comment.id) + "&postId=" + str(post.id) + "'>Down Vote</a><br>"
res += "<a href='groupExpanded.py?upVote=lol&commentId="+\
str(comment.id) + "&postId=" + str(post.id) + "'>Up Vote</a><br>"
res += "<a href='groupExpanded.py?removeVote=lol&commentId="+\
str(comment.id) + "&postId=" + str(post.id) + "'>Remove Vote</a><br>"
res += """</td>
</tr>
</table>
"""
res += "</div>"
break
if 'searchUserPost' in form:
for x in groupList:
if (x.name == searchUserPost):
for post in x.posts:
if post.id == id:
res += post.display()
res += "<br><h3>Comments</h3><br>"
for comment in post.comments:
res += """<table>
<tr>
<td>""" + str(comment.score) + """</td>
<td>
"""
res += comment.display()
res += "<a href='groupExpanded.py?downVote=lol&commentId="+\
str(comment.id) + "'&postId='" + str(post.id) + "'>Down Vote</a><br>"
res += "<a href='groupExpanded.py?upVote=lol&commentId="+\
str(comment.id) + "'&postId='" + str(post.id) + "'>Up Vote</a><br>"
res += "<a href='groupExpanded.py?removeVote=lol&commentId="+\
str(comment.id) + "'&postId='" + str(post.id) + "'>Remove Vote</a><br>"
res += """</td>
</tr>
</table>
"""
break
return res
开发者ID:wertylop5,项目名称:stuy-intro2-sites,代码行数:65,代码来源:groupExpanded.py
示例19: authenticate
c.load(cookie_string)
##print all the data in the cookie
#body+= "<h1>cookie data</h1>"
#for each in c:
# body += each+":"+str(c[each].value)+"<br>"
if 'username' in c and 'ID' in c:
username = c['username'].value
ID = c['ID'].value
IP = os.environ['REMOTE_ADDR']
if authenticate(username,ID,IP):
currentUser = c["username"].value
userDict = stdStuff.objFileToList(stdStuff.directory,
stdStuff.userFile, byName=True)
body += "Logged in as: " + currentUser
body += """<form method="GET" action="homepage.py">
<input name="logOut" type="submit" value="Log out">
</form>
<a href="profile.py">Go back to profile</a>
"""
body += makePage()
if "search" in form:
body += displayUserList(form.getvalue("userTarget"),
userDict)
body += """<br><br><a href="profile.py">Go back to profile</a>"""
else:
body+="Failed to Authenticate cookie<br>\n"
开发者ID:wertylop5,项目名称:stuy-intro2-sites,代码行数:32,代码来源:addFriend.py
示例20: int
"""
if "expandButton" in form:
temp = int(form.getvalue("expandButton"))
lol = open(stdStuff.directory + stdStuff.postIdFile, "w")
lol.write(str(temp))
lol.close()
lol = open(stdStuff.directory + stdStuff.postIdFile, "r")
targId = int(lol.read())
lol.close()
if "done" in form:
writeComment(form.getvalue("comment"), c, targId)
allPosts = stdStuff.objFileToList(stdStuff.directory,
stdStuff.postFile)
for x in allPosts:
if x.id == targId:
body += displayPost(x, "h1", "p", "h3", "p")
break
body += """<a href="profile.py">Go back to profile</a>"""
else:
body+="Failed to Authenticate cookie<br>\n"
body+= 'Go Login <a href="login.py">here</a><br>'
else:
body+= "Your information expired<br>\n"
body+= 'Go Login <a href="login.py">here</a><br>'
else:
body+= 'You seem new<br>\n'
body+='Go Login <a href="login.py">here</a><br>'
开发者ID:wertylop5,项目名称:stuy-intro2-sites,代码行数:32,代码来源:postExpanded.py
注:本文中的stdStuff.objFileToList函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论