<s> import logging <EOL> import genshi <EOL> from shakespeare . lib . base import * <EOL> import shakespeare . model as model <EOL> from shakespeare . controllers . our_resource import render_resource <EOL> log = logging . getLogger ( __name__ ) <EOL> class WorkController ( BaseController ) : <EOL> def index ( self ) : <EOL> c . works_index = model . Work . query . all ( ) <EOL> return render ( '<STR_LIT>' ) <EOL> def info ( self , id ) : <EOL> name = id <EOL> c . work = model . Work . by_name ( name ) <EOL> if not c . work : <EOL> abort ( <NUM_LIT> ) <EOL> return render ( '<STR_LIT>' ) <EOL> def annotate ( self , id = None ) : <EOL> h . redirect_to ( controller = '<STR_LIT>' , action = '<STR_LIT>' , id = id ) <EOL> def view ( self , id = None ) : <EOL> c . work = model . Work . by_name ( id ) <EOL> if c . work is None : <EOL> abort ( <NUM_LIT> ) <EOL> c . annotator_enabled = True <EOL> material = c . work . default_material <EOL> resource = c . work . default_resource <EOL> c . title = material . title <EOL> c . content = genshi . HTML ( render_resource ( resource ) ) <EOL> return render ( '<STR_LIT>' ) </s>
