#NEWLINE# @ classmethod #NEWLINE# def add_views( cls , config , rule_prefix , routename_prefix = None ) : #NEWLINE# #INDENT# "\n        A convenience method for registering the routes and views in pyramid.\n\n        This automatically adds a list and detail endpoint to your routes.\n\n        :param config: The pyramid ``Configurator`` object for your app.\n        :type config: ``pyramid.config.Configurator``\n\n        :param rule_prefix: The start of the URL to handle.\n        :type rule_prefix: string\n\n        :param routename_prefix: (Optional) A prefix for the route's name.\n            The default is ``None``, which will autocreate a prefix based on the\n            class name. Ex: ``PostResource`` -> ``api_post_list``\n        :type routename_prefix: string\n\n        :returns: ``pyramid.config.Configurator``\n        " #NEWLINE# methods = ( 'GET' , 'POST' , 'PUT' , 'DELETE' ) #NEWLINE# config . add_route ( cls . build_routename ( 'list' , routename_prefix ) , routename_prefix ) #NEWLINE# config . add_view ( cls . as_list ( ) , route_name = cls . build_routename ( 'list' , routename_prefix ) , request_method = methods ) #NEWLINE# config . add_route ( cls . build_routename ( 'detail' , routename_prefix ) , ( rule_prefix + '{name}/' ) ) #NEWLINE# config . add_view ( cls . as_detail ( ) , route_name = cls . build_routename ( 'detail' , routename_prefix ) , request_method = methods ) #NEWLINE# return config