From e8864d71678723ad7bd5ed42d19e5f8865977653 Mon Sep 17 00:00:00 2001 From: Manuel Schoenlaub Date: Wed, 22 Apr 2015 13:00:20 +0200 Subject: [PATCH 1/2] Convert Datacenters to a configuration item --- src/web/instance/web.cfg.default | 6 ++++++ src/web/instance/web.cfg.example | 7 +++++++ src/web/instance/web_sample.cfg | 7 +++++++ src/web/monitorforms/datacenter.py | 7 ++----- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/web/instance/web.cfg.default b/src/web/instance/web.cfg.default index 92e75a0..07fabb1 100644 --- a/src/web/instance/web.cfg.default +++ b/src/web/instance/web.cfg.default @@ -132,3 +132,9 @@ SUBSCRIPTIONS = { 'interval': 'month' } } +DATACENTERS = { + 'choices' : { + ("dc1queue", 'DigitalOcean - nyc2'), + ("dc2queue", 'DigitalOcean - sfo1') + } +} diff --git a/src/web/instance/web.cfg.example b/src/web/instance/web.cfg.example index 481766f..75b9646 100644 --- a/src/web/instance/web.cfg.example +++ b/src/web/instance/web.cfg.example @@ -133,3 +133,10 @@ SUBSCRIPTIONS = { 'interval': 'month' } } +DATACENTERS = { + 'choices' : { + ("dc1queue", 'DigitalOcean - nyc2'), + ("dc2queue", 'DigitalOcean - sfo1') + } +} + diff --git a/src/web/instance/web_sample.cfg b/src/web/instance/web_sample.cfg index ab85f22..0f51375 100644 --- a/src/web/instance/web_sample.cfg +++ b/src/web/instance/web_sample.cfg @@ -75,3 +75,10 @@ SUBSCRIPTIONS = { 'interval': 'month' } } +DATACENTERS = { + 'choices' : { + ("dc1queue", 'DigitalOcean - nyc2'), + ("dc2queue", 'DigitalOcean - sfo1') + } +} + diff --git a/src/web/monitorforms/datacenter.py b/src/web/monitorforms/datacenter.py index 8b6d408..a23dabb 100644 --- a/src/web/monitorforms/datacenter.py +++ b/src/web/monitorforms/datacenter.py @@ -7,15 +7,12 @@ from wtforms import SelectMultipleField from wtforms.validators import DataRequired from timer import TimerCheckForm - +from web import app class DatacenterCheckForm(TimerCheckForm): ''' Class that creates an datacenter form for the dashboard ''' - dc_choices = [ - ("dc1queue", 'DigitalOcean - nyc2'), - ("dc2queue", 'DigitalOcean - sfo1') - ] + dc_choices = app.config['DATACENTERS']['choices'] datacenter = SelectMultipleField( "Datacenter", From 0e5617637114753616f6f4ea46fc935d9408b3f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A7alo=20Val=C3=A9rio?= Date: Thu, 23 Apr 2015 20:13:40 +0100 Subject: [PATCH 2/2] added required assembly script --- src/web/templates/assembly.js | 14 ++++++++++++++ src/web/templates/dash-footer.html | 1 + src/web/templates/footer.html | 27 +++++++++++++++------------ src/web/web.py | 2 ++ 4 files changed, 32 insertions(+), 12 deletions(-) create mode 100644 src/web/templates/assembly.js diff --git a/src/web/templates/assembly.js b/src/web/templates/assembly.js new file mode 100644 index 0000000..80cb20a --- /dev/null +++ b/src/web/templates/assembly.js @@ -0,0 +1,14 @@ + diff --git a/src/web/templates/dash-footer.html b/src/web/templates/dash-footer.html index 06481f9..5454697 100644 --- a/src/web/templates/dash-footer.html +++ b/src/web/templates/dash-footer.html @@ -41,6 +41,7 @@ {% for item in data['js_bottom'] %} {% include item %} {% endfor %} + {% include "assembly.js" %} {% block js %}{% endblock %} diff --git a/src/web/templates/footer.html b/src/web/templates/footer.html index e1c0862..2b1b0fc 100644 --- a/src/web/templates/footer.html +++ b/src/web/templates/footer.html @@ -1,14 +1,17 @@ - - + + {% include "assembly.js" %} + + diff --git a/src/web/web.py b/src/web/web.py index 749b5bf..a85d811 100755 --- a/src/web/web.py +++ b/src/web/web.py @@ -23,6 +23,7 @@ import os import sys import cookies +import md5 # Flask modules from flask import Flask @@ -73,6 +74,7 @@ def startData(user=None): data['stripe_pubkey'] = app.config['STRIPE_PUBKEY'] data['subplans'] = user.subplans data['subscription'] = user.subscription + data['email_digest'] = md5.new(user.email).hexdigest() data['js_bottom'] = [] data['js_header'] = [] return data