<s> """<STR_LIT>""" <EOL> import web <EOL> import json <EOL> from x84 . bbs import DBProxy <EOL> from x84 . bbs . ini import CFG <EOL> class OnelinersApi ( object ) : <EOL> """<STR_LIT>""" <EOL> def GET ( self , num = <NUM_LIT:10> ) : <EOL> """<STR_LIT>""" <EOL> num = int ( num ) <EOL> oneliners = DBProxy ( '<STR_LIT>' , use_session = False ) . items ( ) <EOL> oneliners = [ ( int ( k ) , v ) for ( k , v ) in <EOL> DBProxy ( '<STR_LIT>' , use_session = False ) . items ( ) ] <EOL> last = oneliners [ - num : ] <EOL> if '<STR_LIT>' in web . input ( _method = '<STR_LIT>' ) : <EOL> return json . dumps ( last ) <EOL> board = CFG . get ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> page_title = '<STR_LIT>' . format ( <EOL> num = num , board = board ) <EOL> oneliners_html = '<STR_LIT>' <EOL> for line in last : <EOL> val = line [ <NUM_LIT:1> ] <EOL> oneliners_html += '<STR_LIT>' . format ( <EOL> alias = val [ '<STR_LIT>' ] , oneliner = val [ '<STR_LIT>' ] ) <EOL> web . header ( '<STR_LIT:Content-Type>' , '<STR_LIT>' , unique = True ) <EOL> output = """<STR_LIT>""" . format ( page_title = page_title , oneliners_html = oneliners_html ) <EOL> return output <EOL> def web_module ( ) : <EOL> """<STR_LIT>""" <EOL> return { <EOL> '<STR_LIT>' : ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : OnelinersApi <EOL> } <EOL> } </s>
