2024-01-30 01:25:02 -08:00
|
|
|
from pyramid.response import Response
|
|
|
|
from pyramid.view import view_config
|
|
|
|
from ttfrog.db.manager import db
|
|
|
|
from ttfrog.db.schema import Ancestry
|
2024-02-08 23:04:28 -08:00
|
|
|
from ttfrog.attribute_map import AttributeMap
|
|
|
|
|
|
|
|
def response_from(controller):
|
|
|
|
return controller.response() or AttributeMap.from_dict({'c': controller.template_context()})
|
2024-01-30 01:25:02 -08:00
|
|
|
|
|
|
|
|
|
|
|
@view_config(route_name='index')
|
|
|
|
def index(request):
|
|
|
|
ancestries = [a.name for a in db.session.query(Ancestry).all()]
|
|
|
|
return Response(','.join(ancestries))
|
2024-01-31 22:39:54 -08:00
|
|
|
|
|
|
|
|
|
|
|
@view_config(route_name='sheet', renderer='character_sheet.html')
|
|
|
|
def sheet(request):
|
2024-02-08 23:04:28 -08:00
|
|
|
return response_from(request.context)
|