<s> from pyramid import httpexceptions <EOL> from pyramid import session <EOL> from pyramid . view import view_config <EOL> from h import models <EOL> from h . i18n import TranslationString as _ <EOL> @ view_config ( route_name = '<STR_LIT>' , <EOL> request_method = '<STR_LIT:GET>' , <EOL> renderer = '<STR_LIT>' , <EOL> permission = '<STR_LIT>' ) <EOL> def features_index ( _ ) : <EOL> return { "<STR_LIT>" : models . Feature . all ( ) } <EOL> @ view_config ( route_name = '<STR_LIT>' , <EOL> request_method = '<STR_LIT:POST>' , <EOL> permission = '<STR_LIT>' ) <EOL> def features_save ( request ) : <EOL> session . check_csrf_token ( request ) <EOL> for feat in models . Feature . all ( ) : <EOL> for attr in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] : <EOL> val = request . POST . get ( '<STR_LIT>' . format ( feat . name , attr ) ) <EOL> if val == '<STR_LIT>' : <EOL> setattr ( feat , attr , True ) <EOL> else : <EOL> setattr ( feat , attr , False ) <EOL> request . session . flash ( _ ( "<STR_LIT>" ) , "<STR_LIT:success>" ) <EOL> return httpexceptions . HTTPSeeOther ( <EOL> location = request . route_url ( '<STR_LIT>' ) ) <EOL> def includeme ( config ) : <EOL> config . scan ( __name__ ) </s>
