<s> from pyramid . view import view_config <EOL> from sqlalchemy . orm import joinedload , load_only <EOL> from warehouse . cache . origin import origin_cache <EOL> from warehouse . packaging . models import Project , Release <EOL> from warehouse . xml import XML_CSP <EOL> @ view_config ( <EOL> route_name = "<STR_LIT>" , <EOL> renderer = "<STR_LIT>" , <EOL> decorator = [ <EOL> origin_cache ( <EOL> <NUM_LIT:1> * <NUM_LIT> * <NUM_LIT> * <NUM_LIT> , <EOL> stale_while_revalidate = <NUM_LIT:1> * <NUM_LIT> * <NUM_LIT> * <NUM_LIT> , <EOL> stale_if_error = <NUM_LIT:5> * <NUM_LIT> * <NUM_LIT> * <NUM_LIT> , <EOL> ) , <EOL> ] , <EOL> ) <EOL> def rss_updates ( request ) : <EOL> request . response . content_type = "<STR_LIT>" <EOL> request . find_service ( name = "<STR_LIT>" ) . merge ( XML_CSP ) <EOL> latest_releases = ( <EOL> request . db . query ( Release ) <EOL> . options ( joinedload ( Release . project ) ) <EOL> . order_by ( Release . created . desc ( ) ) <EOL> . limit ( <NUM_LIT> ) <EOL> . all ( ) <EOL> ) <EOL> return { "<STR_LIT>" : latest_releases } <EOL> @ view_config ( <EOL> route_name = "<STR_LIT>" , <EOL> renderer = "<STR_LIT>" , <EOL> decorator = [ <EOL> origin_cache ( <EOL> <NUM_LIT:1> * <NUM_LIT> * <NUM_LIT> * <NUM_LIT> , <EOL> stale_while_revalidate = <NUM_LIT:1> * <NUM_LIT> * <NUM_LIT> * <NUM_LIT> , <EOL> stale_if_error = <NUM_LIT:5> * <NUM_LIT> * <NUM_LIT> * <NUM_LIT> , <EOL> ) , <EOL> ] , <EOL> ) <EOL> def rss_packages ( request ) : <EOL> request . response . content_type = "<STR_LIT>" <EOL> request . find_service ( name = "<STR_LIT>" ) . merge ( XML_CSP ) <EOL> newest_projects = ( <EOL> request . db . query ( Project ) <EOL> . options ( load_only ( "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> . options ( joinedload ( Project . releases , innerjoin = True ) <EOL> . load_only ( "<STR_LIT>" ) ) <EOL> . order_by ( Project . created . desc ( ) ) <EOL> . limit ( <NUM_LIT> ) <EOL> . all ( ) <EOL> ) <EOL> return { "<STR_LIT>" : newest_projects } </s>
