本文整理汇总了Python中post.Post.readFromFile方法的典型用法代码示例。如果您正苦于以下问题:Python Post.readFromFile方法的具体用法?Python Post.readFromFile怎么用?Python Post.readFromFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类post.Post
的用法示例。
在下文中一共展示了Post.readFromFile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: edit_post
# 需要导入模块: from post import Post [as 别名]
# 或者: from post.Post import readFromFile [as 别名]
def edit_post(post_name=None):
print "Post Name: ", post_name
if post_name == None:
return "We'll manage all posts from here"
else:
filename = utils.url_to_filename(post_name)
print "Looking for file:", filename
if os.path.isfile(filename):
p = Post.readFromFile(filename)
return render_template("edit_post.html", post=p)
else:
return "No file with name: " + filename
示例2: show_post
# 需要导入模块: from post import Post [as 别名]
# 或者: from post.Post import readFromFile [as 别名]
def show_post(post_name):
filename = utils.url_to_filename(post_name)
if os.path.isfile(filename):
p = Post.readFromFile(filename)
return render_template("post_pretty.html", post=p)
return "Failure"