Source

brightway2-ui / bw2ui / web / app.py

Diff from to

bw2ui/web/app.py

 # -*- coding: utf-8 -*
+import base64
 from brightway2 import config, databases, methods, Database, Method
+from bw2calc import LCA
 from flask import Flask, url_for, render_template
 
 app = Flask(__name__)
     print context
     return "Success"
     return render_template("index.html", **context)
+
+
+@app.route('/calculate/lca')
+@app.route('/calculate/lca/<process>/<method>')
+def lca(process=None, method=None):
+    context = template_context()
+    if process:
+        method = eval(base64.urlsafe_b64decode(str(method)), None, None)
+        process = eval(base64.urlsafe_b64decode(str(process)), None, None)
+        lca = LCA(process, method)
+        lca.lci()
+        lca.lcia()
+        return render_template("lca.html", **context)
+    else:
+        return "No parameters"