本文整理汇总了Python中db.User.get_current_user方法的典型用法代码示例。如果您正苦于以下问题:Python User.get_current_user方法的具体用法?Python User.get_current_user怎么用?Python User.get_current_user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类db.User
的用法示例。
在下文中一共展示了User.get_current_user方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from db import User [as 别名]
# 或者: from db.User import get_current_user [as 别名]
def post(self, *args):
"""
"""
#try:
out = self.response.out
title = self.request.get('title')
oldTitle = self.request.get('oldTitle')
tiddler = self.request.get('tiddler')
html = util.html_unescape(self.request.get('html'))
fileName = self.request.get('fileName')
backupDir = self.request.get('backupDir')
user = self.request.get('user')
password = self.request.get('password')
uploadir = self.request.get('uploadir')
debug = self.request.get('debug')
current_user = User.get_current_user()
if not current_user or (user != current_user.username):
out.write("User '%s' is not logged in Google App."%user)
return
tiddlywiki = Tiddlywiki.get_by_key_name(fileName, parent=current_user)
if tiddler:
# add or change tiddler
(title, modifier, modified, created, tags, text) = parse_tiddler_from_div(tiddler, fileName)
if not oldTitle:
oldTitle = title
t = Tiddler.create_or_update(tiddlywiki.namespace, oldTitle, modifier, modified=modified, created=created, tags=tags, text=text, html=html, newTitle=title)
tiddlywiki.addTiddler(t)
out.write("0 - Tiddler successfully updated in %s\n"%fileName)
return
else:
#delete tiddler and remove it from TiddlyWiki
if title[0].isdigit():
title = " "+title
t = Tiddler.get_by_key_name(title, parent=tiddlywiki.namespace)
tiddlywiki.removeTiddler(t)
t.delete()
out.write("0 - Tiddler successfully deleted in %s\n"%fileName)
return
#except Exception, inst:
# out.write(inst)
# logging.error("storeTiddler: %s"%traceback.print_stack())