def save_new_polycule(): """ Save a created polycule. """ try: polycule = Polycule.create(g.db, request.form['graph'], request.form.get('view_pass', b''), request.form.get('edit_pass', b'')) except Polycule.IdenticalGraph: return render_template('error.jinja2', error='An identical polycule ' 'to the one you submitted already exists!') return redirect('/{}'.format(polycule.graph_hash))
def save_new_polycule(): """ Save a created polycule. """ try: with open('schema.json') as json_data: schema = json.load(json_data) validate(json.loads(request.form['graph']), schema) except Exception: return render_template('error.jinja2', error='The submitted graph could not be parsed') try: polycule = Polycule.create(g.db, request.form['graph'], request.form.get('view_pass', b''), request.form.get('edit_pass', b'')) except Polycule.IdenticalGraph: return render_template('error.jinja2', error='An identical polycule ' 'to the one you submitted already exists!') return redirect('/{}'.format(polycule.graph_hash))
def save_new_polycule(): """ Save a created polycule. """ try: with open('schema.json') as json_data: schema = json.load(json_data) validate(json.loads(request.form['graph']), schema) except Exception: return render_template('error.jinja2', error='The submitted graph could not be parsed') try: polycule = Polycule.create( g.db, request.form['graph'], request.form.get('view_pass', b''), request.form.get('edit_pass', b'')) except Polycule.IdenticalGraph: return render_template('error.jinja2', error='An identical polycule ' 'to the one you submitted already exists!') return redirect('/{}'.format(polycule.graph_hash))
def save_new_polycule(): """ Save a created polycule. """ try: with open("schema.json") as json_data: schema = json.load(json_data) validate(json.loads(request.form["graph"]), schema) except Exception: return render_template("error.jinja2", error="The submitted graph could not be parsed") try: polycule = Polycule.create( g.db, request.form["graph"], request.form.get("view_pass", ""), request.form.get("edit_pass", ""), ) except Polycule.IdenticalGraph: return render_template( "error.jinja2", error="An identical polycule " "to the one you submitted already exists!", ) return redirect("/{}".format(polycule.graph_hash))