示例#1
0
文件: tweb.py 项目: Oreolek/tworld
    (r'/build/addportlist', tweblib.bhandlers.BuildAddPortListHandler),
    (r'/build/delportlist', tweblib.bhandlers.BuildDelPortListHandler),
    (r'/build/addport', tweblib.bhandlers.BuildAddPortHandler),
    (r'/build/setport', tweblib.bhandlers.BuildSetPortHandler),
    (r'/build/setpropaccess', tweblib.bhandlers.BuildSetPropAccessHandler),
    (r'/build/setdata', tweblib.bhandlers.BuildSetDataHandler),
    (r'/admin', tweblib.admhandlers.AdminMainHandler),
    (r'/admin/sessions', tweblib.admhandlers.AdminSessionsHandler),
    (r'/admin/players', tweblib.admhandlers.AdminPlayersHandler),
    (r'/admin/player/([0-9a-f]+)', tweblib.admhandlers.AdminPlayerHandler),
    (r'/websocket', tweblib.handlers.PlayWebSocketHandler),
    ]

# Add in all the top_pages handlers.
for val in opts.top_pages:
    handlers.append( ('/'+val, tweblib.handlers.TopPageHandler, {'page': val}) )

# And any top_static_regex files or directories.
if opts.top_static_regex and opts.top_static_base_path:
    for val in opts.top_static_regex:
        handlers.append( ('/('+val+')', tweblib.handlers.MyStaticFileHandler, {'path': opts.top_static_base_path}) )

# Fallback 404 handler for everything else.
handlers.append( (r'.*', tweblib.handlers.MyNotFoundErrorHandler) )

class TwebApplication(tornado.web.Application):
    """TwebApplication is a customization of the generic Tornado web app
    class.
    """
    
    def init_tworld(self):
示例#2
0
    (r'/build/setprop', tweblib.bhandlers.BuildSetPropHandler),
    (r'/build/addportlist', tweblib.bhandlers.BuildAddPortListHandler),
    (r'/build/delportlist', tweblib.bhandlers.BuildDelPortListHandler),
    (r'/build/addport', tweblib.bhandlers.BuildAddPortHandler),
    (r'/build/setport', tweblib.bhandlers.BuildSetPortHandler),
    (r'/build/setdata', tweblib.bhandlers.BuildSetDataHandler),
    (r'/admin', tweblib.admhandlers.AdminMainHandler),
    (r'/admin/sessions', tweblib.admhandlers.AdminSessionsHandler),
    (r'/admin/players', tweblib.admhandlers.AdminPlayersHandler),
    (r'/admin/player/([0-9a-f]+)', tweblib.admhandlers.AdminPlayerHandler),
    (r'/websocket', tweblib.handlers.PlayWebSocketHandler),
    ]

# Add in all the top_pages handlers.
for val in opts.top_pages:
    handlers.append( ('/'+val, tweblib.handlers.TopPageHandler, {'page': val}) )

# Fallback 404 handler for everything else.
handlers.append( (r'.*', tweblib.handlers.MyNotFoundErrorHandler) )

class TwebApplication(tornado.web.Application):
    """TwebApplication is a customization of the generic Tornado web app
    class.
    """
    
    def init_tworld(self):
        """Perform app-specific initialization.
        """
        # The parsed options (all of them, not just the tornado options)
        self.twopts = opts
        
示例#3
0
    (r'/build/delportlist', tweblib.bhandlers.BuildDelPortListHandler),
    (r'/build/addport', tweblib.bhandlers.BuildAddPortHandler),
    (r'/build/setport', tweblib.bhandlers.BuildSetPortHandler),
    (r'/build/setpropaccess', tweblib.bhandlers.BuildSetPropAccessHandler),
    (r'/build/setdata', tweblib.bhandlers.BuildSetDataHandler),
    (r'/admin', tweblib.admhandlers.AdminMainHandler),
    (r'/admin/sessions', tweblib.admhandlers.AdminSessionsHandler),
    (r'/admin/players', tweblib.admhandlers.AdminPlayersHandler),
    (r'/admin/player/([0-9a-f]+)', tweblib.admhandlers.AdminPlayerHandler),
    (r'/websocket', tweblib.handlers.PlayWebSocketHandler),
]

# Add in all the top_pages handlers.
for val in opts.top_pages:
    handlers.append(('/' + val, tweblib.handlers.TopPageHandler, {
        'page': val
    }))

# And any top_static_regex files or directories.
if opts.top_static_regex and opts.top_static_base_path:
    for val in opts.top_static_regex:
        handlers.append(
            ('/(' + val + ')', tweblib.handlers.MyStaticFileHandler, {
                'path': opts.top_static_base_path
            }))

# Fallback 404 handler for everything else.
handlers.append((r'.*', tweblib.handlers.MyNotFoundErrorHandler))


class TwebApplication(tornado.web.Application):