Add the snapshot endpoint to web.py and have the phantomjs running only load the page's HTML once there are no further pending XHR requests

This commit is contained in:
Joseph Schorr 2013-11-18 17:11:06 -05:00
parent bde0a29296
commit 738973cf39
4 changed files with 87 additions and 1 deletions

View file

@ -11,6 +11,7 @@ from data import model
from app import app, login_manager, mixpanel
from auth.permissions import QuayDeferredPermissionUser, AdministerOrganizationPermission
from util.invoice import renderInvoiceToPdf
from util.seo import renderSnapshot
logger = logging.getLogger(__name__)
@ -49,6 +50,17 @@ def index(path):
return render_template('index.html')
@app.route('/snapshot', methods=['GET'])
@app.route('/snapshot/', methods=['GET'])
@app.route('/snapshot/<path:path>', methods=['GET'])
def snapshot(path = ''):
result = renderSnapshot(path)
if result:
return result
abort(404)
@app.route('/plans/')
def plans():
return index('')