<s> """<STR_LIT>""" <EOL> import webapp2 <EOL> from webapp2_extras import jinja2 <EOL> import general_counter <EOL> import simple_counter <EOL> DEFAULT_COUNTER_NAME = '<STR_LIT>' <EOL> class CounterHandler ( webapp2 . RequestHandler ) : <EOL> """<STR_LIT>""" <EOL> @ webapp2 . cached_property <EOL> def jinja2 ( self ) : <EOL> """<STR_LIT>""" <EOL> return jinja2 . get_jinja2 ( app = self . app ) <EOL> def render_response ( self , template , ** context ) : <EOL> """<STR_LIT>""" <EOL> rendered_value = self . jinja2 . render_template ( template , ** context ) <EOL> self . response . write ( rendered_value ) <EOL> def get ( self ) : <EOL> """<STR_LIT>""" <EOL> simple_total = simple_counter . get_count ( ) <EOL> general_total = general_counter . get_count ( DEFAULT_COUNTER_NAME ) <EOL> self . render_response ( '<STR_LIT>' , simple_total = simple_total , <EOL> general_total = general_total ) <EOL> def post ( self ) : <EOL> """<STR_LIT>""" <EOL> counter = self . request . get ( '<STR_LIT>' ) <EOL> if counter == '<STR_LIT>' : <EOL> simple_counter . increment ( ) <EOL> else : <EOL> general_counter . increment ( DEFAULT_COUNTER_NAME ) <EOL> self . redirect ( '<STR_LIT:/>' ) <EOL> APPLICATION = webapp2 . WSGIApplication ( [ ( '<STR_LIT:/>' , CounterHandler ) ] , <EOL> debug = True ) </s>
