#NEWLINE# def get( self ) : #NEWLINE# #INDENT# site = GetSite ( ) #NEWLINE# template_values = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# template_values [ 'site' ] = site #NEWLINE# method_determined = False #NEWLINE# topic_id = self . request . get ( 'topic_id' ) #NEWLINE# page = self . request . get ( 'page' , 1 ) #NEWLINE# page_size = TOPIC_PAGE_SIZE #NEWLINE# if topic_id : #NEWLINE# #INDENT# page_start = ( ( int ( page ) - 1 ) * page_size ) #NEWLINE# replies = db . GqlQuery ( ( ( ( 'SELECT * FROM Reply WHERE topic_num = :1 ORDER BY created ASC LIMIT ' + str ( page_start ) ) + ',' ) + str ( page_size ) ) , int ( topic_id ) ) #NEWLINE# if replies : #NEWLINE# #INDENT# path = os . path . join ( os . path . dirname ( __file__ ) , 'tpl' , 'api' , 'replies_show.json' ) #NEWLINE# template_values [ 'replies' ] = replies #NEWLINE# output = template . render ( path , template_values ) #NEWLINE# self . write ( output ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# template_values [ 'message' ] = 'Failed to get replies' #NEWLINE# path = os . path . join ( os . path . dirname ( __file__ ) , 'tpl' , 'api' , 'error.json' ) #NEWLINE# output = template . render ( path , template_values ) #NEWLINE# self . response . set_status ( 400 , 'Bad Request' ) #NEWLINE# self . write ( output ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# template_values [ 'message' ] = 'Required parameter topic_id is missing' #NEWLINE# path = os . path . join ( os . path . dirname ( __file__ ) , 'tpl' , 'api' , 'error.json' ) #NEWLINE# output = template . render ( path , template_values ) #NEWLINE# self . response . set_status ( 400 , 'Bad Request' ) #NEWLINE# self . write ( output )