Python base.BaseHandler() Examples

The following are 5 code examples of base.BaseHandler(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module base , or try the search function .
Example #1
Source File: admin.py    From mltshp with Mozilla Public License 2.0 6 votes vote down vote up
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("/") 
Example #2
Source File: ftp.py    From kisskissie with GNU General Public License v3.0 5 votes vote down vote up
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)) 
Example #3
Source File: ftp.py    From kisskissie with GNU General Public License v3.0 5 votes vote down vote up
def handle_close(self):
        base.BaseHandler.handle_close(self)

        if self.outfile is not None:
            self.outfile.close() 
Example #4
Source File: http.py    From kisskissie with GNU General Public License v3.0 5 votes vote down vote up
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)) 
Example #5
Source File: http.py    From kisskissie with GNU General Public License v3.0 5 votes vote down vote up
def handle_close(self):
        base.BaseHandler.handle_close(self)