#NEWLINE# def create_resource( self , path , transaction ) : #NEWLINE# #INDENT# '\n        Render a POST request.\n\n        :param path: the path of the request\n        :param request: the request\n        :param response: the response\n        :return: the response\n        ' #NEWLINE# t = self . _parent . root . with_prefix ( path ) #NEWLINE# max_len = 0 #NEWLINE# imax = None #NEWLINE# for i in t : #NEWLINE# #INDENT# if ( i == path ) : #NEWLINE# #INDENT# return self . edit_resource ( transaction , path ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( len ( i ) > max_len ) : #NEWLINE# #INDENT# imax = i #NEWLINE# max_len = len ( i ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# lp = path #NEWLINE# parent_resource = self . _parent . root [ imax ] #NEWLINE# if parent_resource . allow_children : #NEWLINE# #INDENT# return self . add_resource ( transaction , parent_resource , lp ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# transaction . response . code = defines . Codes . METHOD_NOT_ALLOWED . number #NEWLINE# return transaction