<s> from raggregate . queries import submission <EOL> from pyramid . view import view_config <EOL> from raggregate . models import DBSession <EOL> @ view_config ( renderer = '<STR_LIT>' , route_name = '<STR_LIT>' ) <EOL> def story ( request ) : <EOL> s = request . session <EOL> r = request <EOL> dbsession = DBSession ( ) <EOL> stories = submission . get_story_list ( page_num = <NUM_LIT:1> , per_page = <NUM_LIT:30> , sort = '<STR_LIT>' , request = r ) <EOL> last_update = stories [ '<STR_LIT>' ] [ <NUM_LIT:0> ] . added_on . isoformat ( ) <EOL> request . response . content_type = "<STR_LIT>" <EOL> site_name = r . registry . settings [ '<STR_LIT>' ] <EOL> return { '<STR_LIT>' : stories [ '<STR_LIT>' ] , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : last_update , <EOL> '<STR_LIT>' : '<STR_LIT>' . format ( site_name ) , '<STR_LIT>' : '<STR_LIT>' . format ( site_name ) , <EOL> '<STR_LIT>' : site_name , <EOL> } <EOL> @ view_config ( renderer = '<STR_LIT>' , route_name = '<STR_LIT>' ) <EOL> def self_story ( request ) : <EOL> s = request . session <EOL> r = request <EOL> dbsession = DBSession ( ) <EOL> stories = submission . get_story_list ( page_num = <NUM_LIT:1> , per_page = <NUM_LIT:30> , sort = '<STR_LIT>' , request = r , self_only = True ) <EOL> last_update = stories [ '<STR_LIT>' ] [ <NUM_LIT:0> ] . added_on . isoformat ( ) <EOL> request . response . content_type = "<STR_LIT>" <EOL> site_name = r . registry . settings [ '<STR_LIT>' ] <EOL> return { '<STR_LIT>' : stories [ '<STR_LIT>' ] , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : last_update , <EOL> '<STR_LIT>' : '<STR_LIT>' . format ( site_name ) , '<STR_LIT>' : '<STR_LIT>' . format ( site_name ) , <EOL> '<STR_LIT>' : site_name , <EOL> } <EOL> @ view_config ( renderer = '<STR_LIT>' , route_name = '<STR_LIT>' ) <EOL> def combined ( request ) : <EOL> s = request . session <EOL> r = request <EOL> dbsession = DBSession ( ) <EOL> stories = submission . get_story_list ( page_num = <NUM_LIT:1> , per_page = <NUM_LIT:10> , sort = '<STR_LIT>' , request = r ) <EOL> comments = submission . get_recent_comments ( <NUM_LIT:10> ) <EOL> agg = [ ] <EOL> [ agg . append ( i ) for i in comments ] <EOL> [ agg . append ( i ) for i in stories [ '<STR_LIT>' ] ] <EOL> agg . sort ( key = lambda x : x . added_on , reverse = True ) <EOL> last_update = agg [ <NUM_LIT:0> ] . added_on . isoformat ( ) <EOL> request . response . content_type = "<STR_LIT>" <EOL> site_name = r . registry . settings [ '<STR_LIT>' ] <EOL> return { '<STR_LIT>' : agg , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : last_update , <EOL> '<STR_LIT>' : '<STR_LIT>' . format ( site_name ) , '<STR_LIT>' : '<STR_LIT>' . format ( site_name ) , <EOL> '<STR_LIT>' : site_name , <EOL> } <EOL> @ view_config ( renderer = '<STR_LIT>' , route_name = '<STR_LIT>' ) <EOL> def comment ( request ) : <EOL> s = request . session <EOL> r = request <EOL> dbsession = DBSession ( ) <EOL> comments = submission . get_recent_comments ( <NUM_LIT:20> ) <EOL> last_update = comments [ <NUM_LIT:0> ] . added_on . isoformat ( ) <EOL> request . response . content_type = "<STR_LIT>" <EOL> site_name = r . registry . settings [ '<STR_LIT>' ] <EOL> return { '<STR_LIT>' : comments , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : last_update , <EOL> '<STR_LIT>' : '<STR_LIT>' . format ( site_name ) , '<STR_LIT>' : '<STR_LIT>' . format ( site_name ) , <EOL> '<STR_LIT>' : site_name , <EOL> } </s>
