<s> """<STR_LIT>""" <EOL> from pyramid . view import view_config <EOL> from pyramid_duh import addslash <EOL> from pypicloud . route import PackagesResource <EOL> from pypicloud . views . simple import packages_to_dict <EOL> @ view_config ( context = PackagesResource , request_method = '<STR_LIT:GET>' , subpath = ( ) , <EOL> renderer = '<STR_LIT>' ) <EOL> @ addslash <EOL> def list_packages ( request ) : <EOL> """<STR_LIT>""" <EOL> names = request . db . distinct ( ) <EOL> names = filter ( lambda x : request . access . has_permission ( x , '<STR_LIT>' ) , <EOL> names ) <EOL> packages = [ ] <EOL> for package_name in names : <EOL> packages += request . db . all ( package_name ) <EOL> return { '<STR_LIT>' : packages_to_dict ( request , packages ) } </s>
