def demographic_aggregate():
 def clear_aggregates(r, **attr):
  if (not s3_has_role(ADMIN)):
   auth.permission.fail()
  s3db.stats_demographic_rebuild_all_aggregates()
  redirect(URL(c='stats', f='demographic_aggregate', args=''))
 s3db.set_method('stats', 'demographic_aggregate', method='clear', action=clear_aggregates)
 output = s3_rest_controller()
 return output

def demographic_aggregate ( ) : def clear_aggregates ( r , ** attr ) : if ( not s3_has_role ( ADMIN ) ) : auth . permission . fail ( ) s3db . stats_demographic_rebuild_all_aggregates ( ) redirect ( URL ( c = 'stats' , f = 'demographic_aggregate' , args = '' ) ) s3db . set_method ( 'stats' , 'demographic_aggregate' , method = 'clear' , action = clear_aggregates ) output = s3_rest_controller ( ) return output
rest controller .