1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
from pyramid.httpexceptions import HTTPFound
from pyramid.response import Response
from pyramid.view import view_config
class TutorialViews:
def __init__(self, request):
self.request = request
@view_config(route_name='home')
def home(self):
return HTTPFound(location='/plain')
@view_config(route_name='plain')
def plain(self):
name = self.request.params.get('name', 'No Name Provided')
body = 'URL %s with name: %s' % (self.request.url, name)
return Response(
content_type='text/plain',
body=body
)
|