#NEWLINE# @ request_method_decorator #NEWLINE# def _get_template_request( self , url_template , values = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , **kwargs ) : #NEWLINE# #INDENT# "Generate an HttpRequest from a uri-template.\n\n        This will replace each '{variable}' in the template with the\n        value from kwargs['variable'], or if it does not exist, the\n        value from values['variable']. The resulting url is used to\n        create an HttpRequest.\n        " #NEWLINE# def get_template_value( m ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# return str ( ( kwargs . pop ( m . group ( 'key' ) , None ) or values [ m . group ( 'key' ) ] ) ) #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# raise ValueError ( ( 'Template was not provided a value for "%s"' % m . group ( 'key' ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# url = self . _TEMPLATE_PARAM_RE . sub ( get_template_value , url_template ) #NEWLINE# return HttpRequest ( url , query_args = values )