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)
Exemple #2
0
    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)
Exemple #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')
Exemple #4
0
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
 def test_generic_routes_default_handler(self):
     generic_route('/something', 'some_template.html')
     assert len(route.get_routes()) == 1
Exemple #6
0
 def test_generic_routes_default_handler(self):
     generic_route('/something', 'some_template.html')
     assert len(route.get_routes()) == 1