本文整理匯總了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)