<s> from pyramid . view import view_config <EOL> from pyramid . httpexceptions import HTTPFound <EOL> from . models import ( <EOL> DBSession , <EOL> TaskItem , <EOL> ) <EOL> from . tasks import ( <EOL> DeleteTask , <EOL> add_task <EOL> ) <EOL> import time <EOL> @ view_config ( route_name = '<STR_LIT:index>' , renderer = '<STR_LIT>' ) <EOL> def index ( request ) : <EOL> tasks = DBSession . query ( TaskItem ) . all ( ) <EOL> return { '<STR_LIT>' : tasks } <EOL> @ view_config ( route_name = '<STR_LIT>' ) <EOL> def create_task ( request ) : <EOL> task_val = request . POST [ '<STR_LIT>' ] <EOL> add_task . delay ( task_val ) <EOL> time . sleep ( <NUM_LIT:1> ) <EOL> return HTTPFound ( request . route_url ( '<STR_LIT:index>' ) ) <EOL> @ view_config ( route_name = '<STR_LIT>' ) <EOL> def delete_task ( request ) : <EOL> task_pk = request . matchdict [ '<STR_LIT>' ] <EOL> DeleteTask ( ) . delay ( task_pk ) <EOL> time . sleep ( <NUM_LIT:1> ) <EOL> return HTTPFound ( request . route_url ( '<STR_LIT:index>' ) ) </s>
