示例#1
0
def match_download(id):
  match = model.Match.get_by_id(id)
  match_data = model.MatchData.get_by_id(id)
  abort_if(not match)
  abort_if(not match_data)
  
  data = match_data.raw_data
  abort_if(not data)
  print len(data)
  
  from werkzeug import Headers
  import time
  
  headers = Headers()
  headers.add('Content-Disposition', 'attachment', filename=match.filename)
  
  rv = current_app.response_class(
    data,
    mimetype='application/octet-stream',
    headers=headers,
    direct_passthrough=True,
    )
  rv.cache_control.public = True
  rv.cache_control.max_age = 86400
  rv.expires = int(time.time() + 86400)
  
  return rv
示例#2
0
def match(id):
  match = model.Match.get_by_id(id)
  abort_if(not match)
  return render('match.html', match=match)