本文整理汇总了Python中base.BaseHandler方法的典型用法代码示例。如果您正苦于以下问题:Python base.BaseHandler方法的具体用法?Python base.BaseHandler怎么用?Python base.BaseHandler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类base
的用法示例。
在下文中一共展示了base.BaseHandler方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: import base [as 别名]
# 或者: from base import BaseHandler [as 别名]
def post(self):
category = ShakeCategory(name=self.get_argument('name', ''), short_name=self.get_argument('short_name', ''))
category.save()
return self.redirect('/admin/shake-categories')
#class CreateShakeSharedFilesHandler(BaseHandler):
# @tornado.web.authenticated
# def get(self):
# user = self.current_user
# if user['name'] in ['admin',]:
# shared_files = Sharedfile.all()
# for sf in shared_files:
# user = User.get('id = %s', sf.user_id)
# user_shake = user.shake()
# ssf = Shakesharedfile.get("shake_id = %s and sharedfile_id = %s", user_shake.id, sf.id)
# if not ssf:
# ssf = Shakesharedfile(shake_id = user_shake.id, sharedfile_id = sf.id)
# ssf.save()
# else:
# shared_file = Sharedfile.get('id=%s', ssf.sharedfile_id)
# ssf.created_at = shared_file.created_at
# ssf.save()
# return self.redirect("/")
示例2: __init__
# 需要导入模块: import base [as 别名]
# 或者: from base import BaseHandler [as 别名]
def __init__(self, server, conn, addr):
base.BaseHandler.__init__(self, server, conn, addr)
self.outfile = None
self.set_terminator(b"\r\n")
self.push(b"220 Welcome!\r\n")
logging.info("FTP connection from {}".format(self.addr))
示例3: handle_close
# 需要导入模块: import base [as 别名]
# 或者: from base import BaseHandler [as 别名]
def handle_close(self):
base.BaseHandler.handle_close(self)
if self.outfile is not None:
self.outfile.close()
示例4: __init__
# 需要导入模块: import base [as 别名]
# 或者: from base import BaseHandler [as 别名]
def __init__(self, server, conn, addr):
base.BaseHandler.__init__(self, server, conn, addr)
self.set_terminator(b"\r\n")
logging.info("HTTP connection from {}".format(self.addr))
示例5: handle_close
# 需要导入模块: import base [as 别名]
# 或者: from base import BaseHandler [as 别名]
def handle_close(self):
base.BaseHandler.handle_close(self)