コード例 #1
0
ファイル: test_routes.py プロジェクト: Dinosaurliu/tornroutes
    def setUpClass(cls):
        route._routes = []

        # must be done here prior to get_app being called
        generic_route('/generic', 'generic_1.html')
        generic_route('/other', 'generic_2.html')
        authed_generic_route('/locked', 'generic_1.html', BogonAuthedHandler)
コード例 #2
0
ファイル: test_routes.py プロジェクト: vexchain/tornroutes
    def setUpClass(cls):
        route._routes = []

        # must be done here prior to get_app being called
        generic_route('/generic', 'generic_1.html')
        generic_route('/other', 'generic_2.html')
        authed_generic_route('/locked', 'generic_1.html', BogonAuthedHandler)
コード例 #3
0
from .viewlib import BaseHandler
from tornroutes import route, generic_route

# import time side effects ftw. importing the modules creates our routes
from . import auth
from . import readthis
from . import about
# from . import blog
from . import pages
from . import pastebin
from . import tmp
from . import pagelib

generic_route('/', 'empty_home.html')


@route('.*')
class Handle404(BaseHandler):
    def get(self):
        # self.request.path

        # let's look in the pages book to see if this page exists
        Book = pagelib.Book
        _book = Book(self.application.settings['dbpages'])

        page_maybe = self.request.path[1:]
        if page_maybe in _book:
            return self.redirect('/pages/{}'.format(page_maybe))

        self.render('lost.html')
コード例 #4
0
ファイル: __init__.py プロジェクト: nod/site33
from viewlib import BaseHandler
from tornroutes import route, generic_route

# import time side effects ftw. importing the modules creates our routes
import auth
import about
import blog
import pages
import pastebin
import tmp

generic_route('/projects/?', 'projects.html')

@route('.*')
class Handle404(BaseHandler):
    def get(self):
        # self.request.path

        # let's look in the pages book to see if this page exists
        from pagelib import Book
        _book = Book(self.application.settings['dbpages'])

        page_maybe = self.request.path[1:]
        if page_maybe in _book:
            return self.redirect('/pages/{}'.format(page_maybe))

        self.render('lost.html')


# this needs to be the last line after all views are defined
コード例 #5
0
ファイル: test_routes.py プロジェクト: Dinosaurliu/tornroutes
 def test_generic_routes_default_handler(self):
     generic_route('/something', 'some_template.html')
     assert len(route.get_routes()) == 1
コード例 #6
0
ファイル: test_routes.py プロジェクト: vexchain/tornroutes
 def test_generic_routes_default_handler(self):
     generic_route('/something', 'some_template.html')
     assert len(route.get_routes()) == 1