<s> from flask . ext import restful <EOL> from flask . ext . restful import fields , marshal_with <EOL> from flask . ext . cache import Cache <EOL> from chassis . models import Cat <EOL> api = restful . Api ( ) <EOL> cache = Cache ( ) <EOL> cat_fields = { <EOL> '<STR_LIT:id>' : fields . String , <EOL> '<STR_LIT>' : fields . Integer , <EOL> '<STR_LIT:name>' : fields . String , <EOL> } <EOL> class CatAPI ( restful . Resource ) : <EOL> @ cache . cached ( timeout = <NUM_LIT> ) <EOL> @ marshal_with ( cat_fields ) <EOL> def get ( self , cat_id ) : <EOL> """<STR_LIT>""" <EOL> q = Cat . query . get_or_404 ( cat_id ) <EOL> return q </s>
