#NEWLINE# @ classmethod #NEWLINE# def register( cls , app , name , url , pk_type = None ) : #NEWLINE# #INDENT# view_func = cls . as_view ( name ) #NEWLINE# app . add_url_rule ( url , name , defaults = { #NEWLINE# #INDENT# 'pk' : None , #NEWLINE# #UNINDENT# } , view_func = view_func , methods = [ 'GET' ] ) #NEWLINE# app . add_url_rule ( url , name , defaults = { #NEWLINE# #INDENT# 'pk' : None , #NEWLINE# #UNINDENT# } , view_func = view_func , methods = [ 'POST' ] ) #NEWLINE# if ( pk_type is None ) : #NEWLINE# #INDENT# detail_url = ( url + '<pk>/' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# detail_url = ( url + ( '<%s:pk>/' % pk_type ) ) #NEWLINE# #UNINDENT# name += '_detail' #NEWLINE# app . add_url_rule ( detail_url , name , view_func = view_func , methods = [ 'GET' , 'PUT' , 'POST' , 'DELETE' ] )