From 34acf2310b484920b6dd93fca030d88030128ad8 Mon Sep 17 00:00:00 2001 From: Siarhei Puhach Date: Thu, 3 Aug 2017 12:47:34 +0300 Subject: [PATCH 01/42] Added stripe failed payment error handler --- datacenterlight/views.py | 4 ++++ hosting/templates/hosting/payment.html | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/datacenterlight/views.py b/datacenterlight/views.py index 10e2d791..7dd2a76f 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -426,6 +426,10 @@ class OrderConfirmationView(DetailView): customer = StripeCustomer.objects.filter(id=stripe_customer_id).first() stripe_utils = StripeUtils() card_details = stripe_utils.get_card_details(customer.stripe_id, request.session.get('token')) + if not card_details.get('response_object') and not card_details.get('paid'): + msg = _('Currently its not possible to make payments. Please try later.') + messages.add_message(self.request, messages.ERROR, msg, extra_tags='failed_payment') + return HttpResponseRedirect(reverse('datacenterlight:payment')) context = { 'site_url': reverse('datacenterlight:index'), 'cc_last4': card_details.get('response_object').get('last4'), diff --git a/hosting/templates/hosting/payment.html b/hosting/templates/hosting/payment.html index d03713c1..5ef7f1ce 100644 --- a/hosting/templates/hosting/payment.html +++ b/hosting/templates/hosting/payment.html @@ -49,6 +49,15 @@ +
+ {% for message in messages %} + {% if 'failed_payment' in message.tags %} + + {% endif %} + {% endfor %} +
From 29fb771afb3aa787d0fec7203f4cde0a1c8f50ff Mon Sep 17 00:00:00 2001 From: Siarhei Puhach Date: Fri, 4 Aug 2017 11:01:32 +0300 Subject: [PATCH 02/42] Changed payment error place, changed message source to Stripe errors handler --- datacenterlight/views.py | 2 +- hosting/templates/hosting/payment.html | 32 ++++++++++++++------------ 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/datacenterlight/views.py b/datacenterlight/views.py index 7dd2a76f..993cb508 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -427,7 +427,7 @@ class OrderConfirmationView(DetailView): stripe_utils = StripeUtils() card_details = stripe_utils.get_card_details(customer.stripe_id, request.session.get('token')) if not card_details.get('response_object') and not card_details.get('paid'): - msg = _('Currently its not possible to make payments. Please try later.') + msg = card_details.get('error') messages.add_message(self.request, messages.ERROR, msg, extra_tags='failed_payment') return HttpResponseRedirect(reverse('datacenterlight:payment')) context = { diff --git a/hosting/templates/hosting/payment.html b/hosting/templates/hosting/payment.html index 5ef7f1ce..acb5d389 100644 --- a/hosting/templates/hosting/payment.html +++ b/hosting/templates/hosting/payment.html @@ -49,15 +49,6 @@
-
- {% for message in messages %} - {% if 'failed_payment' in message.tags %} - - {% endif %} - {% endfor %} -
@@ -139,12 +130,23 @@
-

- {% blocktrans %} - You are not making any payment yet. After submitting your card - information, you will be taken to the Confirm Order Page. - {% endblocktrans %} -

+ {% if not messages %} +

+ {% blocktrans %} + You are not making any payment yet. After submitting your card + information, you will be taken to the Confirm Order Page. + {% endblocktrans %} +

+ {% endif %} +
+ {% for message in messages %} + {% if 'failed_payment' in message.tags %} +
  • +

    {{ message|safe }}

    +
+ {% endif %} + {% endfor %} +
From 8769c4cd1f6106ab7526be17e3c256bd28529374 Mon Sep 17 00:00:00 2001 From: Siarhei Puhach Date: Fri, 4 Aug 2017 12:38:24 +0300 Subject: [PATCH 03/42] Changed payment error message style --- hosting/static/hosting/css/landing-page.css | 6 +++++- hosting/templates/hosting/payment.html | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/hosting/static/hosting/css/landing-page.css b/hosting/static/hosting/css/landing-page.css index a7d69094..49471bc8 100644 --- a/hosting/static/hosting/css/landing-page.css +++ b/hosting/static/hosting/css/landing-page.css @@ -537,6 +537,10 @@ a.unlink:hover { border-radius: 3px; padding: 5px; } +.card-warning-error { + border: 1px solid #EB4D5C; + color: #EB4D5C; +} .stripe-payment-btn { outline: none; @@ -718,4 +722,4 @@ a.unlink:hover { .footer-light a:hover, .footer-light a:focus, .footer-light a:active { color: #ddd; -} \ No newline at end of file +} diff --git a/hosting/templates/hosting/payment.html b/hosting/templates/hosting/payment.html index acb5d389..ac9ab41b 100644 --- a/hosting/templates/hosting/payment.html +++ b/hosting/templates/hosting/payment.html @@ -138,11 +138,11 @@ {% endblocktrans %}

{% endif %} -
+
{% for message in messages %} {% if 'failed_payment' in message.tags %}
  • -

    {{ message|safe }}

    +

    {{ message|safe }}

{% endif %} {% endfor %} From d8592fc6d8d3e1c3efba54dfe478a1f0d582b917 Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 6 Aug 2017 12:30:56 +0530 Subject: [PATCH 04/42] Added celery files --- dynamicweb/__init__.py | 5 +++++ dynamicweb/celery.py | 22 ++++++++++++++++++++++ dynamicweb/settings/base.py | 9 +++++++++ requirements.txt | 2 ++ 4 files changed, 38 insertions(+) create mode 100644 dynamicweb/celery.py diff --git a/dynamicweb/__init__.py b/dynamicweb/__init__.py index e69de29b..b64e43e8 100644 --- a/dynamicweb/__init__.py +++ b/dynamicweb/__init__.py @@ -0,0 +1,5 @@ +from __future__ import absolute_import + +# This will make sure the app is always imported when +# Django starts so that shared_task will use this app. +from .celery import app as celery_app diff --git a/dynamicweb/celery.py b/dynamicweb/celery.py new file mode 100644 index 00000000..749ffdef --- /dev/null +++ b/dynamicweb/celery.py @@ -0,0 +1,22 @@ +from __future__ import absolute_import, unicode_literals +import os +from celery import Celery + +# set the default Django settings module for the 'celery' program. +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'dynamicweb.settings') + +app = Celery('dynamicweb') + +# Using a string here means the worker don't have to serialize +# the configuration object to child processes. +# - namespace='CELERY' means all celery-related configuration keys +# should have a `CELERY_` prefix. +app.config_from_object('django.conf:settings', namespace='CELERY') + +# Load task modules from all registered Django app configs. +app.autodiscover_tasks(lambda: settings.INSTALLED_APPS) + + +@app.task(bind=True) +def debug_task(self): + print('Request: {0!r}'.format(self.request)) diff --git a/dynamicweb/settings/base.py b/dynamicweb/settings/base.py index 40187f84..f4c4b68d 100644 --- a/dynamicweb/settings/base.py +++ b/dynamicweb/settings/base.py @@ -521,6 +521,15 @@ GOOGLE_ANALYTICS_PROPERTY_IDS = { 'dynamicweb-staging.ungleich.ch': 'staging' } +# CELERY Settings +#BROKER_URL = 'redis://localhost:6379' +BROKER_URL = 'redis+socket:///var/run/redis/redis.sock' +CELERY_RESULT_BACKEND = 'redis://localhost:6379' +CELERY_ACCEPT_CONTENT = ['application/json'] +CELERY_TASK_SERIALIZER = 'json' +CELERY_RESULT_SERIALIZER = 'json' +CELERY_TIMEZONE = 'Europe/Zurich' + ENABLE_DEBUG_LOGGING = bool_env('ENABLE_DEBUG_LOGGING') if ENABLE_DEBUG_LOGGING: diff --git a/requirements.txt b/requirements.txt index f392f4d9..2520d617 100644 --- a/requirements.txt +++ b/requirements.txt @@ -86,3 +86,5 @@ git+https://github.com/ungleich/python-oca.git#egg=python-oca djangorestframework flake8==3.3.0 python-memcached==1.58 +celery==4.0.2 +redis==2.10.5 From 3ad5928aa0930d7a6a41b0791f179cf847cf7a31 Mon Sep 17 00:00:00 2001 From: "M.Ravi" Date: Sun, 6 Aug 2017 14:33:55 +0200 Subject: [PATCH 05/42] A working version of celery create_vm_task added --- datacenterlight/views.py | 121 +++++++-------------------------------- 1 file changed, 22 insertions(+), 99 deletions(-) diff --git a/datacenterlight/views.py b/datacenterlight/views.py index f7a07c7e..b2798844 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -4,7 +4,6 @@ from .forms import BetaAccessForm from .models import BetaAccess, BetaAccessVMType, BetaAccessVM, VMTemplate from django.contrib import messages from django.core.urlresolvers import reverse -from django.core.mail import EmailMessage from utils.mailer import BaseEmail from django.shortcuts import render from django.shortcuts import redirect @@ -13,14 +12,15 @@ from django.core.exceptions import ValidationError from django.views.decorators.cache import cache_control from django.conf import settings from django.utils.translation import ugettext_lazy as _ -from utils.forms import BillingAddressForm, UserBillingAddressForm +from utils.forms import BillingAddressForm from utils.models import BillingAddress -from hosting.models import HostingOrder, HostingBill +from hosting.models import HostingOrder from utils.stripe_utils import StripeUtils -from datetime import datetime from membership.models import CustomUser, StripeCustomer + from opennebula_api.models import OpenNebulaManager from opennebula_api.serializers import VirtualMachineTemplateSerializer, VirtualMachineSerializer, VMTemplateSerializer +from datacenterlight.tasks import create_vm_task class LandingProgramView(TemplateView): @@ -33,7 +33,6 @@ class SuccessView(TemplateView): def get(self, request, *args, **kwargs): if 'specs' not in request.session or 'user' not in request.session: return HttpResponseRedirect(reverse('datacenterlight:index')) - elif 'token' not in request.session: return HttpResponseRedirect(reverse('datacenterlight:payment')) elif 'order_confirmation' not in request.session: @@ -79,8 +78,7 @@ class PricingView(TemplateView): manager = OpenNebulaManager() template = manager.get_template(template_id) - request.session['template'] = VirtualMachineTemplateSerializer( - template).data + request.session['template'] = VirtualMachineTemplateSerializer(template).data if not request.user.is_authenticated(): request.session['next'] = reverse('hosting:payment') @@ -132,8 +130,7 @@ class BetaAccessView(FormView): email = BaseEmail(**email_data) email.send() - messages.add_message( - self.request, messages.SUCCESS, self.success_message) + messages.add_message(self.request, messages.SUCCESS, self.success_message) return render(self.request, 'datacenterlight/beta_success.html', {}) @@ -185,8 +182,7 @@ class BetaProgramView(CreateView): email = BaseEmail(**email_data) email.send() - messages.add_message( - self.request, messages.SUCCESS, self.success_message) + messages.add_message(self.request, messages.SUCCESS, self.success_message) return HttpResponseRedirect(self.get_success_url()) @@ -199,15 +195,15 @@ class IndexView(CreateView): def validate_cores(self, value): if (value > 48) or (value < 1): - raise ValidationError(_('Invalid number of cores')) + raise ValidationError(_('Not a proper cores number')) def validate_memory(self, value): if (value > 200) or (value < 2): - raise ValidationError(_('Invalid RAM size')) + raise ValidationError(_('Not a proper ram number')) def validate_storage(self, value): if (value > 2000) or (value < 10): - raise ValidationError(_('Invalid storage size')) + raise ValidationError(_('Not a proper storage number')) @cache_control(no_cache=True, must_revalidate=True, no_store=True) def get(self, request, *args, **kwargs): @@ -230,8 +226,7 @@ class IndexView(CreateView): storage_field = forms.IntegerField(validators=[self.validate_storage]) price = request.POST.get('total') template_id = int(request.POST.get('config')) - template = VMTemplate.objects.filter( - opennebula_vm_template_id=template_id).first() + template = VMTemplate.objects.filter(opennebula_vm_template_id=template_id).first() template_data = VMTemplateSerializer(template).data name = request.POST.get('name') @@ -243,40 +238,35 @@ class IndexView(CreateView): cores = cores_field.clean(cores) except ValidationError as err: msg = '{} : {}.'.format(cores, str(err)) - messages.add_message( - self.request, messages.ERROR, msg, extra_tags='cores') + messages.add_message(self.request, messages.ERROR, msg, extra_tags='cores') return HttpResponseRedirect(reverse('datacenterlight:index') + "#order_form") try: memory = memory_field.clean(memory) except ValidationError as err: msg = '{} : {}.'.format(memory, str(err)) - messages.add_message( - self.request, messages.ERROR, msg, extra_tags='memory') + messages.add_message(self.request, messages.ERROR, msg, extra_tags='memory') return HttpResponseRedirect(reverse('datacenterlight:index') + "#order_form") try: storage = storage_field.clean(storage) except ValidationError as err: msg = '{} : {}.'.format(storage, str(err)) - messages.add_message( - self.request, messages.ERROR, msg, extra_tags='storage') + messages.add_message(self.request, messages.ERROR, msg, extra_tags='storage') return HttpResponseRedirect(reverse('datacenterlight:index') + "#order_form") try: name = name_field.clean(name) except ValidationError as err: msg = '{} {}.'.format(name, _('is not a proper name')) - messages.add_message( - self.request, messages.ERROR, msg, extra_tags='name') + messages.add_message(self.request, messages.ERROR, msg, extra_tags='name') return HttpResponseRedirect(reverse('datacenterlight:index') + "#order_form") try: email = email_field.clean(email) except ValidationError as err: msg = '{} {}.'.format(email, _('is not a proper email')) - messages.add_message( - self.request, messages.ERROR, msg, extra_tags='email') + messages.add_message(self.request, messages.ERROR, msg, extra_tags='email') return HttpResponseRedirect(reverse('datacenterlight:index') + "#order_form") specs = { @@ -341,8 +331,7 @@ class IndexView(CreateView): email = BaseEmail(**email_data) email.send() - messages.add_message( - self.request, messages.SUCCESS, self.success_message) + messages.add_message(self.request, messages.SUCCESS, self.success_message) return super(IndexView, self).form_valid(form) @@ -411,7 +400,6 @@ class PaymentOrderView(FormView): # Create Billing Address billing_address = form.save() - request.session['billing_address_data'] = billing_address_data request.session['billing_address'] = billing_address.id request.session['token'] = token @@ -436,8 +424,7 @@ class OrderConfirmationView(DetailView): stripe_customer_id = request.session.get('customer') customer = StripeCustomer.objects.filter(id=stripe_customer_id).first() stripe_utils = StripeUtils() - card_details = stripe_utils.get_card_details( - customer.stripe_id, request.session.get('token')) + card_details = stripe_utils.get_card_details(customer.stripe_id, request.session.get('token')) context = { 'site_url': reverse('datacenterlight:index'), 'cc_last4': card_details.get('response_object').get('last4'), @@ -453,8 +440,7 @@ class OrderConfirmationView(DetailView): customer = StripeCustomer.objects.filter(id=stripe_customer_id).first() billing_address_data = request.session.get('billing_address_data') billing_address_id = request.session.get('billing_address') - billing_address = BillingAddress.objects.filter( - id=billing_address_id).first() + billing_address = BillingAddress.objects.filter(id=billing_address_id).first() vm_template_id = template.get('id', 1) final_price = specs.get('price') @@ -473,71 +459,8 @@ class OrderConfirmationView(DetailView): return render(request, self.payment_template_name, context) charge = charge_response.get('response_object') - - # Create OpenNebulaManager - manager = OpenNebulaManager(email=settings.OPENNEBULA_USERNAME, - password=settings.OPENNEBULA_PASSWORD) - - # Create a vm using oneadmin, also specify the name - vm_id = manager.create_vm( - template_id=vm_template_id, - specs=specs, - vm_name="{email}-{template_name}-{date}".format( - email=user.get('email'), - template_name=template.get('name'), - date=int(datetime.now().strftime("%s"))) - ) - - # Create a Hosting Order - order = HostingOrder.create( - price=final_price, - vm_id=vm_id, - customer=customer, - billing_address=billing_address - ) - - # Create a Hosting Bill - HostingBill.create( - customer=customer, billing_address=billing_address) - - # Create Billing Address for User if he does not have one - if not customer.user.billing_addresses.count(): - billing_address_data.update({ - 'user': customer.user.id - }) - billing_address_user_form = UserBillingAddressForm( - billing_address_data) - billing_address_user_form.is_valid() - billing_address_user_form.save() - - # Associate an order with a stripe payment - order.set_stripe_charge(charge) - - # If the Stripe payment was successed, set order status approved - order.set_approved() - - vm = VirtualMachineSerializer(manager.get_vm(vm_id)).data - - context = { - 'name': user.get('name'), - 'email': user.get('email'), - 'cores': specs.get('cpu'), - 'memory': specs.get('memory'), - 'storage': specs.get('disk_size'), - 'price': specs.get('price'), - 'template': template.get('name'), - 'vm.name': vm['name'], - 'vm.id': vm['vm_id'], - 'order.id': order.id - } - email_data = { - 'subject': settings.DCL_TEXT + " Order from %s" % context['email'], - 'from_email': settings.DCL_SUPPORT_FROM_ADDRESS, - 'to': ['info@ungleich.ch'], - 'body': "\n".join(["%s=%s" % (k, v) for (k, v) in context.items()]), - 'reply_to': [context['email']], - } - email = EmailMessage(**email_data) - email.send() + create_vm_task.delay(vm_template_id, user, specs, template, stripe_customer_id, billing_address_data, + billing_address_id, + charge) request.session['order_confirmation'] = True return HttpResponseRedirect(reverse('datacenterlight:order_success')) From bd2edf599ae4b8e02cc43167821d9bf3adac75e3 Mon Sep 17 00:00:00 2001 From: "M.Ravi" Date: Sun, 6 Aug 2017 15:08:05 +0200 Subject: [PATCH 06/42] Merged views from master --- datacenterlight/views.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/datacenterlight/views.py b/datacenterlight/views.py index b2798844..e37b2914 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -17,7 +17,6 @@ from utils.models import BillingAddress from hosting.models import HostingOrder from utils.stripe_utils import StripeUtils from membership.models import CustomUser, StripeCustomer - from opennebula_api.models import OpenNebulaManager from opennebula_api.serializers import VirtualMachineTemplateSerializer, VirtualMachineSerializer, VMTemplateSerializer from datacenterlight.tasks import create_vm_task @@ -195,15 +194,15 @@ class IndexView(CreateView): def validate_cores(self, value): if (value > 48) or (value < 1): - raise ValidationError(_('Not a proper cores number')) + raise ValidationError(_('Invalid number of cores')) def validate_memory(self, value): if (value > 200) or (value < 2): - raise ValidationError(_('Not a proper ram number')) + raise ValidationError(_('Invalid RAM size')) def validate_storage(self, value): if (value > 2000) or (value < 10): - raise ValidationError(_('Not a proper storage number')) + raise ValidationError(_('Invalid storage size')) @cache_control(no_cache=True, must_revalidate=True, no_store=True) def get(self, request, *args, **kwargs): From d6d0b9c8c0eed4394d3610ccade37cbc9395fefc Mon Sep 17 00:00:00 2001 From: "M.Ravi" Date: Sun, 6 Aug 2017 15:08:46 +0200 Subject: [PATCH 07/42] Added default init code for celery --- dynamicweb/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dynamicweb/__init__.py b/dynamicweb/__init__.py index b64e43e8..de98902b 100644 --- a/dynamicweb/__init__.py +++ b/dynamicweb/__init__.py @@ -1,5 +1,7 @@ -from __future__ import absolute_import +from __future__ import absolute_import, unicode_literals # This will make sure the app is always imported when # Django starts so that shared_task will use this app. from .celery import app as celery_app + +__all__ = ['celery_app'] \ No newline at end of file From 477c8e81a40aeef502764082c5c22b02c77e512a Mon Sep 17 00:00:00 2001 From: "M.Ravi" Date: Sun, 6 Aug 2017 15:10:26 +0200 Subject: [PATCH 08/42] Added default celery.py code --- dynamicweb/celery.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dynamicweb/celery.py b/dynamicweb/celery.py index 749ffdef..28f6af3b 100644 --- a/dynamicweb/celery.py +++ b/dynamicweb/celery.py @@ -14,7 +14,7 @@ app = Celery('dynamicweb') app.config_from_object('django.conf:settings', namespace='CELERY') # Load task modules from all registered Django app configs. -app.autodiscover_tasks(lambda: settings.INSTALLED_APPS) +app.autodiscover_tasks() @app.task(bind=True) From 68505e73a8c834f3728e633c38dbf89e7b70de96 Mon Sep 17 00:00:00 2001 From: "M.Ravi" Date: Sun, 6 Aug 2017 16:32:27 +0200 Subject: [PATCH 09/42] Added django-celery-results and setup redis as backend for celery tasks --- dynamicweb/settings/base.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dynamicweb/settings/base.py b/dynamicweb/settings/base.py index f4c4b68d..4847851f 100644 --- a/dynamicweb/settings/base.py +++ b/dynamicweb/settings/base.py @@ -120,7 +120,8 @@ INSTALLED_APPS = ( 'datacenterlight.templatetags', 'alplora', 'rest_framework', - 'opennebula_api' + 'opennebula_api', + 'django_celery_results', ) MIDDLEWARE_CLASSES = ( @@ -522,9 +523,10 @@ GOOGLE_ANALYTICS_PROPERTY_IDS = { } # CELERY Settings -#BROKER_URL = 'redis://localhost:6379' -BROKER_URL = 'redis+socket:///var/run/redis/redis.sock' -CELERY_RESULT_BACKEND = 'redis://localhost:6379' +# BROKER_URL = 'redis://localhost:6379' +CELERY_BROKER_URL = 'redis+socket:///tmp/redis.sock' +# CELERY_RESULT_BACKEND = 'redis://localhost:6379' +CELERY_RESULT_BACKEND = 'redis+socket:///tmp/redis.sock' CELERY_ACCEPT_CONTENT = ['application/json'] CELERY_TASK_SERIALIZER = 'json' CELERY_RESULT_SERIALIZER = 'json' From 55177646b456be63805604eb5d2188d0c9bd5d4f Mon Sep 17 00:00:00 2001 From: "M.Ravi" Date: Sun, 6 Aug 2017 16:33:37 +0200 Subject: [PATCH 10/42] Reformatted code --- hosting/models.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/hosting/models.py b/hosting/models.py index 88386913..8cdc6114 100644 --- a/hosting/models.py +++ b/hosting/models.py @@ -1,13 +1,9 @@ import os import logging - from django.db import models from django.utils.functional import cached_property - - from Crypto.PublicKey import RSA - from membership.models import StripeCustomer, CustomUser from utils.models import BillingAddress from utils.mixins import AssignPermissionsMixin @@ -42,7 +38,6 @@ class HostingPlan(models.Model): class HostingOrder(AssignPermissionsMixin, models.Model): - ORDER_APPROVED_STATUS = 'Approved' ORDER_DECLINED_STATUS = 'Declined' @@ -101,7 +96,7 @@ class HostingOrder(AssignPermissionsMixin, models.Model): class UserHostingKey(models.Model): user = models.ForeignKey(CustomUser) public_key = models.TextField() - private_key = models.FileField(upload_to='private_keys', blank=True) + private_key = models.FileField(upload_to='private_keys', blank=True) created_at = models.DateTimeField(auto_now_add=True) name = models.CharField(max_length=100) From 6d28783f9ffd526aa076289379ffdca927c693b1 Mon Sep 17 00:00:00 2001 From: "M.Ravi" Date: Sun, 6 Aug 2017 16:34:23 +0200 Subject: [PATCH 11/42] Added django-celery-results to requirements --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 2520d617..abce2271 100644 --- a/requirements.txt +++ b/requirements.txt @@ -88,3 +88,4 @@ flake8==3.3.0 python-memcached==1.58 celery==4.0.2 redis==2.10.5 +django-celery-results==1.0.1 From 5a5654be018239ae192864316ceb5a4e4c54be99 Mon Sep 17 00:00:00 2001 From: "M.Ravi" Date: Sun, 6 Aug 2017 16:51:07 +0200 Subject: [PATCH 12/42] Moved CELERY_BROKER_URL and CELERY_RESULT_BACKEND to .env file --- dynamicweb/settings/base.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/dynamicweb/settings/base.py b/dynamicweb/settings/base.py index 4847851f..fbe0c9ca 100644 --- a/dynamicweb/settings/base.py +++ b/dynamicweb/settings/base.py @@ -523,10 +523,8 @@ GOOGLE_ANALYTICS_PROPERTY_IDS = { } # CELERY Settings -# BROKER_URL = 'redis://localhost:6379' -CELERY_BROKER_URL = 'redis+socket:///tmp/redis.sock' -# CELERY_RESULT_BACKEND = 'redis://localhost:6379' -CELERY_RESULT_BACKEND = 'redis+socket:///tmp/redis.sock' +CELERY_BROKER_URL = env('CELERY_BROKER_URL') +CELERY_RESULT_BACKEND = env('CELERY_RESULT_BACKEND') CELERY_ACCEPT_CONTENT = ['application/json'] CELERY_TASK_SERIALIZER = 'json' CELERY_RESULT_SERIALIZER = 'json' From 26b4feb1d16296036ccb3fe75f11f96501f3e964 Mon Sep 17 00:00:00 2001 From: "M.Ravi" Date: Sun, 6 Aug 2017 18:39:45 +0200 Subject: [PATCH 13/42] Introduced int_env and CELERY_MAX_RETRIES env variable --- dynamicweb/settings/base.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/dynamicweb/settings/base.py b/dynamicweb/settings/base.py index fbe0c9ca..58609234 100644 --- a/dynamicweb/settings/base.py +++ b/dynamicweb/settings/base.py @@ -10,6 +10,9 @@ from django.utils.translation import ugettext_lazy as _ # dotenv import dotenv +import logging + +logger = logging.getLogger(__name__) def gettext(s): @@ -25,6 +28,20 @@ def bool_env(val): return True if os.environ.get(val, False) == 'True' else False +def int_env(val, default_value=0): + """Replaces string based environment values with Python integers + Return default_value if val is not set or cannot be parsed, otherwise + returns the python integer equal to the passed val + """ + return_value = default_value + try: + return_value = int(os.environ.get(val)) + except Exception as e: + logger.error(str(e)) + + return return_value + + BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) PROJECT_DIR = os.path.abspath( @@ -529,6 +546,7 @@ CELERY_ACCEPT_CONTENT = ['application/json'] CELERY_TASK_SERIALIZER = 'json' CELERY_RESULT_SERIALIZER = 'json' CELERY_TIMEZONE = 'Europe/Zurich' +CELERY_MAX_RETRIES = int_env('CELERY_MAX_RETRIES', 5) ENABLE_DEBUG_LOGGING = bool_env('ENABLE_DEBUG_LOGGING') From f950c1defb23a0cba62bbbbb732a5428f2f416a5 Mon Sep 17 00:00:00 2001 From: "M.Ravi" Date: Sun, 6 Aug 2017 18:42:27 +0200 Subject: [PATCH 14/42] Added datacenterlight/tasks.py --- datacenterlight/tasks.py | 162 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 datacenterlight/tasks.py diff --git a/datacenterlight/tasks.py b/datacenterlight/tasks.py new file mode 100644 index 00000000..69ba08ad --- /dev/null +++ b/datacenterlight/tasks.py @@ -0,0 +1,162 @@ +from __future__ import absolute_import, unicode_literals +from dynamicweb.celery import app +from celery.utils.log import get_task_logger +from django.conf import settings +from opennebula_api.models import OpenNebulaManager +from opennebula_api.serializers import VirtualMachineSerializer +from hosting.models import HostingOrder, HostingBill +from utils.forms import UserBillingAddressForm +from datetime import datetime +from membership.models import StripeCustomer +from django.core.mail import EmailMessage +from utils.models import BillingAddress + +logger = get_task_logger(__name__) + + +def retry_task(task, exception=None): + """Retries the specified task using a "backing off countdown", + meaning that the interval between retries grows exponentially + with every retry. + + Arguments: + task: + The task to retry. + + exception: + Optionally, the exception that caused the retry. + """ + + def backoff(attempts): + return 2 ** attempts + + kwargs = { + 'countdown': backoff(task.request.retries), + } + + if exception: + kwargs['exc'] = exception + + if task.request.retries > settings.CELERY_MAX_RETRIES: + msg_text = 'Finished {} retries for create_vm_task'.format(task.request.retries) + logger.log(msg_text) + # Try sending email and stop + email_data = { + 'subject': '{} CELERY TASK ERROR: {}'.format(settings.DCL_TEXT, msg_text), + 'from_email': settings.DCL_SUPPORT_FROM_ADDRESS, + 'to': ['info@ungleich.ch'], + 'body': "\n".join(["%s=%s" % (k, v) for (k, v) in kwargs.items()]), + } + email = EmailMessage(**email_data) + email.send() + return + else: + raise task.retry(**kwargs) + + +@app.task(bind=True) +def create_vm_task(self, vm_template_id, user, specs, template, stripe_customer_id, billing_address_data, + billing_address_id, + charge): + try: + final_price = specs.get('price') + billing_address = BillingAddress.objects.filter(id=billing_address_id).first() + customer = StripeCustomer.objects.filter(id=stripe_customer_id).first() + # Create OpenNebulaManager + manager = OpenNebulaManager(email=settings.OPENNEBULA_USERNAME, + password=settings.OPENNEBULA_PASSWORD) + + # Create a vm using oneadmin, also specify the name + vm_id = manager.create_vm( + template_id=vm_template_id, + specs=specs, + vm_name="{email}-{template_name}-{date}".format( + email=user.get('email'), + template_name=template.get('name'), + date=int(datetime.now().strftime("%s"))) + ) + + # Create a Hosting Order + order = HostingOrder.create( + price=final_price, + vm_id=vm_id, + customer=customer, + billing_address=billing_address + ) + + # Create a Hosting Bill + HostingBill.create( + customer=customer, billing_address=billing_address) + + # Create Billing Address for User if he does not have one + if not customer.user.billing_addresses.count(): + billing_address_data.update({ + 'user': customer.user.id + }) + billing_address_user_form = UserBillingAddressForm( + billing_address_data) + billing_address_user_form.is_valid() + billing_address_user_form.save() + + # Associate an order with a stripe payment + charge_object = DictDotLookup(charge) + order.set_stripe_charge(charge_object) + + # If the Stripe payment succeeds, set order status approved + order.set_approved() + + vm = VirtualMachineSerializer(manager.get_vm(vm_id)).data + + context = { + 'name': user.get('name'), + 'email': user.get('email'), + 'cores': specs.get('cpu'), + 'memory': specs.get('memory'), + 'storage': specs.get('disk_size'), + 'price': specs.get('price'), + 'template': template.get('name'), + 'vm.name': vm['name'], + 'vm.id': vm['vm_id'], + 'order.id': order.id + } + email_data = { + 'subject': settings.DCL_TEXT + " Order from %s" % context['email'], + 'from_email': settings.DCL_SUPPORT_FROM_ADDRESS, + 'to': ['info@ungleich.ch'], + 'body': "\n".join(["%s=%s" % (k, v) for (k, v) in context.items()]), + 'reply_to': [context['email']], + } + email = EmailMessage(**email_data) + email.send() + except Exception as e: + logger.error(str(e)) + retry_task(self) + + +class DictDotLookup(object): + """ + Creates objects that behave much like a dictionaries, but allow nested + key access using object '.' (dot) lookups. + """ + + def __init__(self, d): + for k in d: + if isinstance(d[k], dict): + self.__dict__[k] = DictDotLookup(d[k]) + elif isinstance(d[k], (list, tuple)): + l = [] + for v in d[k]: + if isinstance(v, dict): + l.append(DictDotLookup(v)) + else: + l.append(v) + self.__dict__[k] = l + else: + self.__dict__[k] = d[k] + + def __getitem__(self, name): + if name in self.__dict__: + return self.__dict__[name] + + def __iter__(self): + return iter(self.__dict__.keys()) From e7864f5d85788a44abab26ded38e5ec1808fc7a8 Mon Sep 17 00:00:00 2001 From: "M.Ravi" Date: Sun, 6 Aug 2017 18:52:23 +0200 Subject: [PATCH 15/42] Added condition to check if create_vm succeeded --- datacenterlight/tasks.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/datacenterlight/tasks.py b/datacenterlight/tasks.py index 69ba08ad..9f0249a2 100644 --- a/datacenterlight/tasks.py +++ b/datacenterlight/tasks.py @@ -58,6 +58,7 @@ def retry_task(task, exception=None): def create_vm_task(self, vm_template_id, user, specs, template, stripe_customer_id, billing_address_data, billing_address_id, charge): + vm_id = None try: final_price = specs.get('price') billing_address = BillingAddress.objects.filter(id=billing_address_id).first() @@ -76,6 +77,9 @@ def create_vm_task(self, vm_template_id, user, specs, template, stripe_customer_ date=int(datetime.now().strftime("%s"))) ) + if vm_id is None: + raise Exception("Could not create VM") + # Create a Hosting Order order = HostingOrder.create( price=final_price, @@ -132,6 +136,8 @@ def create_vm_task(self, vm_template_id, user, specs, template, stripe_customer_ logger.error(str(e)) retry_task(self) + return vm_id + class DictDotLookup(object): """ From 58bb75481491589d9024c399e448f3ae8336683d Mon Sep 17 00:00:00 2001 From: "M.Ravi" Date: Sun, 6 Aug 2017 21:54:12 +0200 Subject: [PATCH 16/42] Introduced MaxRetries and MaxRetriesExceededError handling code --- datacenterlight/tasks.py | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/datacenterlight/tasks.py b/datacenterlight/tasks.py index 9f0249a2..342c87f4 100644 --- a/datacenterlight/tasks.py +++ b/datacenterlight/tasks.py @@ -10,6 +10,7 @@ from datetime import datetime from membership.models import StripeCustomer from django.core.mail import EmailMessage from utils.models import BillingAddress +from celery.exceptions import MaxRetriesExceededError logger = get_task_logger(__name__) @@ -37,24 +38,10 @@ def retry_task(task, exception=None): if exception: kwargs['exc'] = exception - if task.request.retries > settings.CELERY_MAX_RETRIES: - msg_text = 'Finished {} retries for create_vm_task'.format(task.request.retries) - logger.log(msg_text) - # Try sending email and stop - email_data = { - 'subject': '{} CELERY TASK ERROR: {}'.format(settings.DCL_TEXT, msg_text), - 'from_email': settings.DCL_SUPPORT_FROM_ADDRESS, - 'to': ['info@ungleich.ch'], - 'body': "\n".join(["%s=%s" % (k, v) for (k, v) in kwargs.items()]), - } - email = EmailMessage(**email_data) - email.send() - return - else: - raise task.retry(**kwargs) + raise task.retry(**kwargs) -@app.task(bind=True) +@app.task(bind=True, max_retries=settings.CELERY_MAX_RETRIES) def create_vm_task(self, vm_template_id, user, specs, template, stripe_customer_id, billing_address_data, billing_address_id, charge): @@ -134,7 +121,21 @@ def create_vm_task(self, vm_template_id, user, specs, template, stripe_customer_ email.send() except Exception as e: logger.error(str(e)) - retry_task(self) + try: + retry_task(self) + except MaxRetriesExceededError: + msg_text = 'Finished {} retries for create_vm_task'.format(self.request.retries) + logger.error(msg_text) + # Try sending email and stop + email_data = { + 'subject': '{} CELERY TASK ERROR: {}'.format(settings.DCL_TEXT, msg_text), + 'from_email': settings.DCL_SUPPORT_FROM_ADDRESS, + 'to': ['info@ungleich.ch'], + 'body':',\n'.join(str(i) for i in self.request.args) + } + email = EmailMessage(**email_data) + email.send() + return return vm_id From 29b28d551c2f3caf20929f6eb5f57187ed81c9f9 Mon Sep 17 00:00:00 2001 From: "M.Ravi" Date: Sun, 6 Aug 2017 22:19:27 +0200 Subject: [PATCH 17/42] Fixed flake8 lint warnings --- datacenterlight/tasks.py | 2 +- datacenterlight/views.py | 4 +--- dynamicweb/__init__.py | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/datacenterlight/tasks.py b/datacenterlight/tasks.py index 342c87f4..dc71fcee 100644 --- a/datacenterlight/tasks.py +++ b/datacenterlight/tasks.py @@ -131,7 +131,7 @@ def create_vm_task(self, vm_template_id, user, specs, template, stripe_customer_ 'subject': '{} CELERY TASK ERROR: {}'.format(settings.DCL_TEXT, msg_text), 'from_email': settings.DCL_SUPPORT_FROM_ADDRESS, 'to': ['info@ungleich.ch'], - 'body':',\n'.join(str(i) for i in self.request.args) + 'body': ',\n'.join(str(i) for i in self.request.args) } email = EmailMessage(**email_data) email.send() diff --git a/datacenterlight/views.py b/datacenterlight/views.py index e37b2914..2bae5c77 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -13,12 +13,11 @@ from django.views.decorators.cache import cache_control from django.conf import settings from django.utils.translation import ugettext_lazy as _ from utils.forms import BillingAddressForm -from utils.models import BillingAddress from hosting.models import HostingOrder from utils.stripe_utils import StripeUtils from membership.models import CustomUser, StripeCustomer from opennebula_api.models import OpenNebulaManager -from opennebula_api.serializers import VirtualMachineTemplateSerializer, VirtualMachineSerializer, VMTemplateSerializer +from opennebula_api.serializers import VirtualMachineTemplateSerializer, VMTemplateSerializer from datacenterlight.tasks import create_vm_task @@ -439,7 +438,6 @@ class OrderConfirmationView(DetailView): customer = StripeCustomer.objects.filter(id=stripe_customer_id).first() billing_address_data = request.session.get('billing_address_data') billing_address_id = request.session.get('billing_address') - billing_address = BillingAddress.objects.filter(id=billing_address_id).first() vm_template_id = template.get('id', 1) final_price = specs.get('price') diff --git a/dynamicweb/__init__.py b/dynamicweb/__init__.py index de98902b..3b91b070 100644 --- a/dynamicweb/__init__.py +++ b/dynamicweb/__init__.py @@ -4,4 +4,4 @@ from __future__ import absolute_import, unicode_literals # Django starts so that shared_task will use this app. from .celery import app as celery_app -__all__ = ['celery_app'] \ No newline at end of file +__all__ = ['celery_app'] From 4de04b2663c47d5e367e84570faf39288e49ae5e Mon Sep 17 00:00:00 2001 From: Siarhei Puhach Date: Mon, 7 Aug 2017 09:56:57 +0300 Subject: [PATCH 18/42] Changed visa card error placement --- hosting/templates/hosting/payment.html | 6 ++++-- utils/stripe_utils.py | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/hosting/templates/hosting/payment.html b/hosting/templates/hosting/payment.html index 41c6d3eb..449962a5 100644 --- a/hosting/templates/hosting/payment.html +++ b/hosting/templates/hosting/payment.html @@ -59,7 +59,6 @@ {% csrf_token %} {% bootstrap_field field show_label=False type='fields'%} {% endfor %} - {% bootstrap_form_errors form type='non_fields'%}
@@ -130,7 +129,7 @@
- {% if not messages %} + {% if not messages and not form.errors %}

{% blocktrans %} You are not making any payment yet. After submitting your card @@ -146,6 +145,9 @@ {% endif %} {% endfor %} + {% if form.errors %} + {% bootstrap_form_errors form type='non_fields'%} + {% endif %}

diff --git a/utils/stripe_utils.py b/utils/stripe_utils.py index d46cf54d..f7d52157 100644 --- a/utils/stripe_utils.py +++ b/utils/stripe_utils.py @@ -11,7 +11,7 @@ def handleStripeError(f): 'error': None } - common_message = "Currently its not possible to make payments." + common_message = "Currently it's not possible to make payments." try: response_object = f(*args, **kwargs) response = { From 4fea099b5d8cba24e6a39a35a3a38961e4db9a5b Mon Sep 17 00:00:00 2001 From: Siarhei Puhach Date: Mon, 7 Aug 2017 10:05:12 +0300 Subject: [PATCH 19/42] Changed invalid credit card error style --- hosting/templates/hosting/payment.html | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hosting/templates/hosting/payment.html b/hosting/templates/hosting/payment.html index 449962a5..cb7a4d8c 100644 --- a/hosting/templates/hosting/payment.html +++ b/hosting/templates/hosting/payment.html @@ -145,8 +145,13 @@ {% endif %} {% endfor %} + {% if form.errors %} - {% bootstrap_form_errors form type='non_fields'%} + {% for error in form.non_field_errors %} +

+ {{ error|escape }} +

+ {% endfor %} {% endif %}
From 4cd3d6a4aada182b3d88ec7a6f6e2743278a7754 Mon Sep 17 00:00:00 2001 From: Siarhei Puhach Date: Mon, 7 Aug 2017 13:36:21 +0300 Subject: [PATCH 20/42] Added stripe make_charge error handler --- datacenterlight/views.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/datacenterlight/views.py b/datacenterlight/views.py index dcf64814..d82522e9 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -467,15 +467,12 @@ class OrderConfirmationView(DetailView): stripe_utils = StripeUtils() charge_response = stripe_utils.make_charge(amount=final_price, customer=customer.stripe_id) - charge = charge_response.get('response_object') # Check if the payment was approved - if not charge: - context = {} - context.update({ - 'paymentError': charge_response.get('error') - }) - return render(request, self.payment_template_name, context) + if not charge_response.get('response_object') and not charge_response.get('paid'): + msg = charge_response.get('error') + messages.add_message(self.request, messages.ERROR, msg, extra_tags='make_charge_error') + return HttpResponseRedirect(reverse('datacenterlight:payment')) charge = charge_response.get('response_object') From a71ccbc56615d2f8370d912ae8e4702b261144ed Mon Sep 17 00:00:00 2001 From: Siarhei Puhach Date: Mon, 7 Aug 2017 17:02:47 +0300 Subject: [PATCH 21/42] Added error hash in url, added payment error handler to hosting/views --- datacenterlight/views.py | 4 +- hosting/templates/hosting/payment.html | 57 ++++++++++++++------------ hosting/views.py | 11 ++--- 3 files changed, 37 insertions(+), 35 deletions(-) diff --git a/datacenterlight/views.py b/datacenterlight/views.py index d82522e9..b20b212f 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -441,7 +441,7 @@ class OrderConfirmationView(DetailView): if not card_details.get('response_object') and not card_details.get('paid'): msg = card_details.get('error') messages.add_message(self.request, messages.ERROR, msg, extra_tags='failed_payment') - return HttpResponseRedirect(reverse('datacenterlight:payment')) + return HttpResponseRedirect(reverse('datacenterlight:payment') + '#dcl_payment_error') context = { 'site_url': reverse('datacenterlight:index'), @@ -472,7 +472,7 @@ class OrderConfirmationView(DetailView): if not charge_response.get('response_object') and not charge_response.get('paid'): msg = charge_response.get('error') messages.add_message(self.request, messages.ERROR, msg, extra_tags='make_charge_error') - return HttpResponseRedirect(reverse('datacenterlight:payment')) + return HttpResponseRedirect(reverse('datacenterlight:payment') + '#dcl_payment_error') charge = charge_response.get('response_object') diff --git a/hosting/templates/hosting/payment.html b/hosting/templates/hosting/payment.html index cb7a4d8c..4c4ffa62 100644 --- a/hosting/templates/hosting/payment.html +++ b/hosting/templates/hosting/payment.html @@ -85,13 +85,29 @@
-

- {% blocktrans %} - You are not making any payment yet. After submitting your card - information, you will be taken to the Confirm Order Page. - {% endblocktrans %} -

-
+ {% if not messages and not form.non_field_errors %} +

+ {% blocktrans %} + You are not making any payment yet. After submitting your card + information, you will be taken to the Confirm Order Page. + {% endblocktrans %} +

+ {% endif %} +
+ {% for message in messages %} + {% if 'failed_payment' or 'make_charge_error' in message.tags %} +
  • +

    {{ message|safe }}

    +
+ {% endif %} + {% endfor %} + {% for error in form.non_field_errors %} +

+ {{ error|escape }} +

+ {% endfor %} +
+
- {% if not messages and not form.errors %} + {% if not messages and not form.non_field_errors %}

{% blocktrans %} You are not making any payment yet. After submitting your card @@ -137,22 +153,20 @@ {% endblocktrans %}

{% endif %} -
+
{% for message in messages %} - {% if 'failed_payment' in message.tags %} + {% if 'failed_payment' or 'make_charge_error' in message.tags %}
  • {{ message|safe }}

{% endif %} {% endfor %} - {% if form.errors %} - {% for error in form.non_field_errors %} -

- {{ error|escape }} -

- {% endfor %} - {% endif %} + {% for error in form.non_field_errors %} +

+ {{ error|escape }} +

+ {% endfor %}
@@ -168,15 +182,6 @@

- {% if paymentError %} -
-
-

- {% bootstrap_alert paymentError alert_type='danger' %} -

-
-
- {% endif %} {% endif %} diff --git a/hosting/views.py b/hosting/views.py index 19ec5b2a..d1666b04 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -557,15 +557,12 @@ class PaymentVMView(LoginRequiredMixin, FormView): stripe_utils = StripeUtils() charge_response = stripe_utils.make_charge(amount=final_price, customer=customer.stripe_id) - charge = charge_response.get('response_object') # Check if the payment was approved - if not charge: - context.update({ - 'paymentError': charge_response.get('error'), - 'form': form - }) - return render(request, self.template_name, context) + if not charge_response.get('response_object') and not charge_response.get('paid'): + msg = charge_response.get('error') + messages.add_message(self.request, messages.ERROR, msg, extra_tags='make_charge_error') + return HttpResponseRedirect(reverse('hosting:payment') + '#hosting_payment_error') charge = charge_response.get('response_object') From 72ddfd96ab0fad277a1471ba3c723c6c5ff4fc45 Mon Sep 17 00:00:00 2001 From: Siarhei Puhach Date: Mon, 7 Aug 2017 17:23:58 +0300 Subject: [PATCH 22/42] Payment error was unified --- datacenterlight/views.py | 4 ++-- hosting/templates/hosting/payment.html | 4 ++-- hosting/views.py | 7 ++++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/datacenterlight/views.py b/datacenterlight/views.py index b20b212f..929b0833 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -441,7 +441,7 @@ class OrderConfirmationView(DetailView): if not card_details.get('response_object') and not card_details.get('paid'): msg = card_details.get('error') messages.add_message(self.request, messages.ERROR, msg, extra_tags='failed_payment') - return HttpResponseRedirect(reverse('datacenterlight:payment') + '#dcl_payment_error') + return HttpResponseRedirect(reverse('datacenterlight:payment') + '#payment_error') context = { 'site_url': reverse('datacenterlight:index'), @@ -472,7 +472,7 @@ class OrderConfirmationView(DetailView): if not charge_response.get('response_object') and not charge_response.get('paid'): msg = charge_response.get('error') messages.add_message(self.request, messages.ERROR, msg, extra_tags='make_charge_error') - return HttpResponseRedirect(reverse('datacenterlight:payment') + '#dcl_payment_error') + return HttpResponseRedirect(reverse('datacenterlight:payment') + '#payment_error') charge = charge_response.get('response_object') diff --git a/hosting/templates/hosting/payment.html b/hosting/templates/hosting/payment.html index 4c4ffa62..7bf84645 100644 --- a/hosting/templates/hosting/payment.html +++ b/hosting/templates/hosting/payment.html @@ -93,7 +93,7 @@ {% endblocktrans %}

{% endif %} -
+
{% for message in messages %} {% if 'failed_payment' or 'make_charge_error' in message.tags %}
  • @@ -153,7 +153,7 @@ {% endblocktrans %}

    {% endif %} -
    +
    {% for message in messages %} {% if 'failed_payment' or 'make_charge_error' in message.tags %}
    • diff --git a/hosting/views.py b/hosting/views.py index d1666b04..c5877ca2 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -547,8 +547,9 @@ class PaymentVMView(LoginRequiredMixin, FormView): customer = StripeCustomer.get_or_create(email=owner.email, token=token) if not customer: - form.add_error("__all__", "Invalid credit card") - return self.render_to_response(self.get_context_data(form=form)) + msg = _("Invalid credit card") + messages.add_message(self.request, messages.ERROR, msg, extra_tags='make_charge_error') + return HttpResponseRedirect(reverse('hosting:payment') + '#payment_error') # Create Billing Address billing_address = form.save() @@ -562,7 +563,7 @@ class PaymentVMView(LoginRequiredMixin, FormView): if not charge_response.get('response_object') and not charge_response.get('paid'): msg = charge_response.get('error') messages.add_message(self.request, messages.ERROR, msg, extra_tags='make_charge_error') - return HttpResponseRedirect(reverse('hosting:payment') + '#hosting_payment_error') + return HttpResponseRedirect(reverse('hosting:payment') + '#payment_error') charge = charge_response.get('response_object') From 227d3a20a526f3e30915e99a2b0fc3d4ef0fbbe9 Mon Sep 17 00:00:00 2001 From: PCoder Date: Tue, 8 Aug 2017 01:57:29 +0530 Subject: [PATCH 23/42] Removed __future__ --- dynamicweb/__init__.py | 2 -- dynamicweb/celery.py | 1 - 2 files changed, 3 deletions(-) diff --git a/dynamicweb/__init__.py b/dynamicweb/__init__.py index 3b91b070..1a6c551d 100644 --- a/dynamicweb/__init__.py +++ b/dynamicweb/__init__.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, unicode_literals - # This will make sure the app is always imported when # Django starts so that shared_task will use this app. from .celery import app as celery_app diff --git a/dynamicweb/celery.py b/dynamicweb/celery.py index 28f6af3b..609ef5c4 100644 --- a/dynamicweb/celery.py +++ b/dynamicweb/celery.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, unicode_literals import os from celery import Celery From 8029f058243c02d13f45c277d6c4f552b034c701 Mon Sep 17 00:00:00 2001 From: PCoder Date: Tue, 8 Aug 2017 02:12:13 +0530 Subject: [PATCH 24/42] Added env variable to logger message --- dynamicweb/settings/base.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dynamicweb/settings/base.py b/dynamicweb/settings/base.py index 58609234..a0d31592 100644 --- a/dynamicweb/settings/base.py +++ b/dynamicweb/settings/base.py @@ -37,7 +37,8 @@ def int_env(val, default_value=0): try: return_value = int(os.environ.get(val)) except Exception as e: - logger.error(str(e)) + logger.error("Encountered exception trying to get env value for {}\nException details: {}".format( + val, str(e))) return return_value From 7cf46ad8b8845727716af28c0309f4013c45e99c Mon Sep 17 00:00:00 2001 From: ARvind Tiwari Date: Wed, 9 Aug 2017 00:21:25 +0530 Subject: [PATCH 25/42] override bootstrap default danger color #a94442 -> #eb4d5c --- .../datacenterlight/css/landing-page.css | 49 ++++++++++++++----- hosting/static/hosting/css/landing-page.css | 38 +++++++++++++- 2 files changed, 73 insertions(+), 14 deletions(-) diff --git a/datacenterlight/static/datacenterlight/css/landing-page.css b/datacenterlight/static/datacenterlight/css/landing-page.css index 6c813661..70554a1d 100755 --- a/datacenterlight/static/datacenterlight/css/landing-page.css +++ b/datacenterlight/static/datacenterlight/css/landing-page.css @@ -1081,19 +1081,6 @@ tech-sub-sec h2 { padding: 0; } -.has-error .checkbox, -.has-error .checkbox-inline, -.has-error .control-label, -.has-error .help-block, -.has-error .radio, -.has-error .radio-inline, -.has-error.checkbox label, -.has-error.checkbox-inline label, -.has-error.radio label, -.has-error.radio-inline label { - color: #eb4d5c; -} - .form-group { margin: 0; border-bottom: 1px solid rgba(128, 128, 128, 0.3); @@ -1519,4 +1506,40 @@ a#forgotpassword { .w380 { max-width: 380px !important; +} + +/* bootstrap danger color override from #a94442 */ +.text-danger, +.has-error .help-block, +.has-error .control-label, +.has-error .radio, +.has-error .checkbox, +.has-error .radio-inline, +.has-error .checkbox-inline, +.has-error.radio label, +.has-error.checkbox label, +.has-error.radio-inline label, +.has-error.checkbox-inline label, +.has-error .form-control, +.has-error .form-control-feedback, +.alert-danger, +.list-group-item-danger, +a.list-group-item-danger, +a.list-group-item-danger:hover, +a.list-group-item-danger:focus, +.panel-danger > .panel-heading { + color: #eb4d5c; +} +.has-error .input-group-addon { + color: #eb4d5c; + border-color: #eb4d5c; +} +a.list-group-item-danger.active, +a.list-group-item-danger.active:hover, +a.list-group-item-danger.active:focus { + background-color: #eb4d5c; + border-color: #eb4d5c; +} +.panel-danger > .panel-heading .badge { + background-color: #eb4d5c; } \ No newline at end of file diff --git a/hosting/static/hosting/css/landing-page.css b/hosting/static/hosting/css/landing-page.css index d17ef8f2..3c3cd8a0 100644 --- a/hosting/static/hosting/css/landing-page.css +++ b/hosting/static/hosting/css/landing-page.css @@ -331,7 +331,7 @@ h6 { } .auth-box .form .red { - color: #ea3a3a; + color: #eb4d5c; } .auth-box .form .btn { @@ -738,3 +738,39 @@ a.unlink:hover { .footer-light a:hover, .footer-light a:focus, .footer-light a:active { color: #ddd; } + +/* bootstrap danger color override from #a94442 */ +.text-danger, +.has-error .help-block, +.has-error .control-label, +.has-error .radio, +.has-error .checkbox, +.has-error .radio-inline, +.has-error .checkbox-inline, +.has-error.radio label, +.has-error.checkbox label, +.has-error.radio-inline label, +.has-error.checkbox-inline label, +.has-error .form-control, +.has-error .form-control-feedback, +.alert-danger, +.list-group-item-danger, +a.list-group-item-danger, +a.list-group-item-danger:hover, +a.list-group-item-danger:focus, +.panel-danger > .panel-heading { + color: #eb4d5c; +} +.has-error .input-group-addon { + color: #eb4d5c; + border-color: #eb4d5c; +} +a.list-group-item-danger.active, +a.list-group-item-danger.active:hover, +a.list-group-item-danger.active:focus { + background-color: #eb4d5c; + border-color: #eb4d5c; +} +.panel-danger > .panel-heading .badge { + background-color: #eb4d5c; +} \ No newline at end of file From e92e3a9527d348a6976d02d32732316fb7cb1d1b Mon Sep 17 00:00:00 2001 From: Arvind Tiwari Date: Wed, 16 Aug 2017 04:02:22 +0530 Subject: [PATCH 26/42] new design for page /my-virtual-machines --- hosting/static/hosting/css/commons.css | 88 ++++++++--- .../static/hosting/css/virtual-machine.css | 143 ++++++++++++++++++ hosting/static/hosting/img/copy.svg | 7 + hosting/static/hosting/img/vm.svg | 7 + .../templates/hosting/virtual_machines.html | 72 ++++++++- 5 files changed, 294 insertions(+), 23 deletions(-) create mode 100644 hosting/static/hosting/img/copy.svg create mode 100644 hosting/static/hosting/img/vm.svg diff --git a/hosting/static/hosting/css/commons.css b/hosting/static/hosting/css/commons.css index 156e1974..1ebae4b4 100644 --- a/hosting/static/hosting/css/commons.css +++ b/hosting/static/hosting/css/commons.css @@ -162,29 +162,75 @@ /* ========= */ @media(min-width: 320px) { - .modal:before { - content: ''; - display: inline-block; - height: 100%; - vertical-align: middle; - margin-right: -4px; - } - } + .modal:before { + content: ''; + display: inline-block; + height: 100%; + vertical-align: middle; + margin-right: -4px; + } +} - @media (min-width: 768px) { - .modal-dialog { +@media (min-width: 768px) { + .modal-dialog { /* width: 520px; */ - margin: 15px auto; - } - } + margin: 15px auto; + } +} - .modal { - text-align: center; - } +.modal { + text-align: center; +} - .modal-dialog { - display: inline-block; - text-align: left; - vertical-align: middle; - } +.modal-dialog { + display: inline-block; + text-align: left; + vertical-align: middle; +} + +.un-icon { + width: 15px; + height: 15px; + opacity: 0.5; + margin-top: -1px; +} + +.css-plus { + position: relative; + width: 16px; + height: 20px; + display: inline-block; + vertical-align: middle; + /* top: -1px; */ +} + +.css-plus + span { + vertical-align: middle; +} + +.css-plus:before { + content: ''; + width: 10px; + height: 2px; + background: #f6f7f9; + position: absolute; + left: 50%; + top: 50%; + -webkit-transform: translate(-50%,-50%); + -ms-transform: translate(-50%,-50%); + transform: translate(-50%,-50%); +} + +.css-plus:after { + content: ''; + width: 2px; + height: 10px; + background: #f6f7f9; + position: absolute; + left: 50%; + top: 50%; + -webkit-transform: translate(-50%,-50%); + -ms-transform: translate(-50%,-50%); + transform: translate(-50%,-50%); +} \ No newline at end of file diff --git a/hosting/static/hosting/css/virtual-machine.css b/hosting/static/hosting/css/virtual-machine.css index e043879d..0dd89866 100644 --- a/hosting/static/hosting/css/virtual-machine.css +++ b/hosting/static/hosting/css/virtual-machine.css @@ -227,4 +227,147 @@ .btn-create-vm { float: left !important; } +} + +/* New styles */ +.dashboard-title-thin { + font-weight: 300; + font-size: 32px; +} + +.dashboard-title-thin .un-icon { + height: 34px; + margin-right: 5px; + margin-top: -1px; + width: 20px; +} + +.dashboard-subtitle { + font-weight: 300; + margin-bottom: 25px; +} + +.btn-vm { + background: #1596DA; + color: #fff; + font-weight: 400; + letter-spacing: 0.8px; + border-radius: 3px; + padding-bottom: 7px; + border: 2px solid #1596DA; +} + +.btn-vm:hover, .btn-vm:focus { + color: #1596DA; + background: #fff; +} +.btn-vm:hover .css-plus:after, +.btn-vm:focus .css-plus:after, +.btn-vm:hover .css-plus:before, +.btn-vm:focus .css-plus:before { + background: #1596DA; +} +.btn-vm-detail { + background: #3770CC; + color: #fff; + font-weight: 400; + letter-spacing: 0.6px; + font-size: 14px; + border-radius: 3px; + border: 2px solid #3770CC; + padding: 4px 20px; + /* padding-bottom: 7px; */ +} + +.btn-vm-detail:hover, .btn-vm-detail:focus { + background: #fff; + color: #3770CC; +} + +.vm-status, .vm-status-active, .vm-status-failed { + font-weight: 600; +} +.vm-status-active { + color: #4A90E2; +} +.vm-status-failed { + color: #eb4d5c; +} + +@media (min-width:768px) { + .dashboard-subtitle { + display: flex; + justify-content: space-between; + font-size: 16px; + } +} +@media (max-width:767px) { + .dashboard-title-thin { + font-size: 22px; + } + .dashboard-title-thin .un-icon { + height: 20px; + width: 18px; + margin-top: -3px; + } + .dashboard-subtitle p { + width: 200px; + } +} + +.table-switch { + color: #555; +} + +.table-switch > tbody > tr > td { + padding: 12px 8px; +} + +@media (min-width: 768px) { + .table-switch > tbody > tr > td:nth-child(1) { + padding-right: 45px; + } +} + +.table-switch .un-icon { + margin-left: 5px; +} + +@media (max-width:767px) { + .dashboard-subtitle { + margin-bottom: 15px; + } + .table-switch .un-icon { + float: right; + margin-top: 0; + } + .table-switch thead { + display: none; + } + .table-switch tbody tr { + display: block; + position: relative; + border-top: 1px solid #ddd; + margin-top: 15px; + padding-top: 5px; + } + .table-switch tbody tr td { + display: block; + padding-top: 28px; + padding-bottom: 6px; + position: relative; + border: 0; + } + .table-switch td:before { + content: attr(data-header); + font-weight: 600; + position: absolute; + top: 5px; + + } + .table-switch .last-td { + position: absolute; + bottom: 5px; + right: 0; + } } \ No newline at end of file diff --git a/hosting/static/hosting/img/copy.svg b/hosting/static/hosting/img/copy.svg new file mode 100644 index 00000000..c30b5922 --- /dev/null +++ b/hosting/static/hosting/img/copy.svg @@ -0,0 +1,7 @@ + + + + + Svg Vector Icons : http://www.onlinewebfonts.com/icon + + \ No newline at end of file diff --git a/hosting/static/hosting/img/vm.svg b/hosting/static/hosting/img/vm.svg new file mode 100644 index 00000000..376e7d0a --- /dev/null +++ b/hosting/static/hosting/img/vm.svg @@ -0,0 +1,7 @@ + + + + + Svg Vector Icons : http://www.onlinewebfonts.com/icon + + \ No newline at end of file diff --git a/hosting/templates/hosting/virtual_machines.html b/hosting/templates/hosting/virtual_machines.html index c149be41..5ee9e1ff 100644 --- a/hosting/templates/hosting/virtual_machines.html +++ b/hosting/templates/hosting/virtual_machines.html @@ -1,6 +1,75 @@ {% extends "hosting/base_short.html" %} {% load staticfiles bootstrap3 i18n %} {% block content %} +
      +

      {% trans "Virtual Machines" %}

      +
      +

      {% trans 'To create a new virtual machine, click "Create VM"' %}

      + +
      + + + + + + + + + + + + + {% for vm in vms %} + + + {% if vm.ipv6 %} + + + {% endif %} + + + + {% endfor %} + + + + + + + + + + + + + + + +
      IDIpv4Ipv6{% trans "Status" %}
      {{vm.vm_id}}{{vm.ipv4}}{{vm.ipv6}} + {% if vm.state == 'ACTIVE' %} + {{vm.state}} + {% elif vm.state == 'FAILED' %} + {{vm.state}} + {% else %} + {{vm.state}} + {% endif %} + + + {% trans "View Detail"%} +
      13638185.203.112.75 2a0a:e5c0:0:2:400:b3ff:fe39:7996 + Active + + View Detail +
      13638185.203.112.75 2a0a:e5c0:0:2:400:b3ff:fe39:7996 + Failed + + View Detail +
      +
      + +{% comment %}
      @@ -78,12 +147,11 @@
      {% endif %} -
    - +{% endcomment %} {%endblock%} From aec4073af5115a3a1c7cc7a16ac3b0d3feac312a Mon Sep 17 00:00:00 2001 From: Arvind Tiwari Date: Wed, 16 Aug 2017 04:08:44 +0530 Subject: [PATCH 27/42] removed testing markup from html --- .../templates/hosting/virtual_machines.html | 23 ------------------- 1 file changed, 23 deletions(-) diff --git a/hosting/templates/hosting/virtual_machines.html b/hosting/templates/hosting/virtual_machines.html index 5ee9e1ff..db1909a4 100644 --- a/hosting/templates/hosting/virtual_machines.html +++ b/hosting/templates/hosting/virtual_machines.html @@ -36,35 +36,12 @@ {% else %} {{vm.state}} {% endif %} - {% trans "View Detail"%} {% endfor %} - - 13638 - 185.203.112.75 - 2a0a:e5c0:0:2:400:b3ff:fe39:7996 - - Active - - - View Detail - - - - 13638 - 185.203.112.75 - 2a0a:e5c0:0:2:400:b3ff:fe39:7996 - - Failed - - - View Detail - -
From 8160e53ea71d8bc152be424002969b7048323cb8 Mon Sep 17 00:00:00 2001 From: Arvind Tiwari Date: Wed, 16 Aug 2017 04:10:08 +0530 Subject: [PATCH 28/42] removed commented html --- .../templates/hosting/virtual_machines.html | 87 +------------------ 1 file changed, 1 insertion(+), 86 deletions(-) diff --git a/hosting/templates/hosting/virtual_machines.html b/hosting/templates/hosting/virtual_machines.html index db1909a4..2d033a8d 100644 --- a/hosting/templates/hosting/virtual_machines.html +++ b/hosting/templates/hosting/virtual_machines.html @@ -1,5 +1,6 @@ {% extends "hosting/base_short.html" %} {% load staticfiles bootstrap3 i18n %} + {% block content %}

{% trans "Virtual Machines" %}

@@ -45,90 +46,4 @@
- -{% comment %} -
-
-
-
- -

{% trans "Virtual Machines"%}

-
-
- {% if messages %} -
- {% for message in messages %} - {{ message }} - {% endfor %} -
- {% endif %} -
- {% if not error %} -

- {% trans "Create VM"%} -

-
- - - - - - - - - - - - {% for vm in vms %} - - - {% if vm.ipv6 %} - - - - {% endif %} - - - - - {% endfor %} - - {% endif %} -
{% trans "ID"%}{% trans "Ipv4"%}{% trans "Ipv6"%}{% trans "Status"%}
{{vm.vm_id}}{{vm.ipv4}}{{vm.ipv6}} - - {% if vm.state == 'ACTIVE' %} - {{vm.state}} - {% elif vm.state == 'FAILED' %} - {{vm.state}} - {% else %} - {{vm.state}} - {% endif %} - - - -
- - {% if is_paginated %} - - {% endif %} -
- -
-
- -
-{% endcomment %} {%endblock%} From 337021a470541eacc22b832e21bc163735cbeb37 Mon Sep 17 00:00:00 2001 From: Arvind Tiwari Date: Wed, 16 Aug 2017 04:13:40 +0530 Subject: [PATCH 29/42] added other conditional components on page --- .../templates/hosting/virtual_machines.html | 192 ++++++++++++++---- 1 file changed, 151 insertions(+), 41 deletions(-) diff --git a/hosting/templates/hosting/virtual_machines.html b/hosting/templates/hosting/virtual_machines.html index 2d033a8d..c792bc08 100644 --- a/hosting/templates/hosting/virtual_machines.html +++ b/hosting/templates/hosting/virtual_machines.html @@ -1,49 +1,159 @@ {% extends "hosting/base_short.html" %} {% load staticfiles bootstrap3 i18n %} - {% block content %}

{% trans "Virtual Machines" %}

-
-

{% trans 'To create a new virtual machine, click "Create VM"' %}

- -
- - - - - - - - - - - - - {% for vm in vms %} - - - {% if vm.ipv6 %} - - - {% endif %} - - - + {% if messages %} +
+ {% for message in messages %} + {{ message }} {% endfor %} -
-
IDIpv4Ipv6{% trans "Status" %}
{{vm.vm_id}}{{vm.ipv4}}{{vm.ipv6}} - {% if vm.state == 'ACTIVE' %} - {{vm.state}} - {% elif vm.state == 'FAILED' %} - {{vm.state}} - {% else %} - {{vm.state}} - {% endif %} - - {% trans "View Detail"%} -
+
+ {% endif %} + + {% if not error %} +
+

{% trans 'To create a new virtual machine, click "Create VM"' %}

+ +
+ + + + + + + + + + + + {% for vm in vms %} + + + {% if vm.ipv6 %} + + + {% endif %} + + + + {% endfor %} + +
IDIpv4Ipv6{% trans "Status" %}
{{vm.vm_id}}{{vm.ipv4}}{{vm.ipv6}} + {% if vm.state == 'ACTIVE' %} + {{vm.state}} + {% elif vm.state == 'FAILED' %} + {{vm.state}} + {% else %} + {{vm.state}} + {% endif %} + + {% trans "View Detail"%} +
+ {% endif %} + + {% if is_paginated %} + + {% endif %}
+ +{% comment %} +
+
+
+
+ +

{% trans "Virtual Machines"%}

+
+
+ {% if messages %} +
+ {% for message in messages %} + {{ message }} + {% endfor %} +
+ {% endif %} +
+ {% if not error %} +

+ {% trans "Create VM"%} +

+
+ + + + + + + + + + + + {% for vm in vms %} + + + {% if vm.ipv6 %} + + + + {% endif %} + + + + + {% endfor %} + + {% endif %} +
{% trans "ID"%}{% trans "Ipv4"%}{% trans "Ipv6"%}{% trans "Status"%}
{{vm.vm_id}}{{vm.ipv4}}{{vm.ipv6}} + + {% if vm.state == 'ACTIVE' %} + {{vm.state}} + {% elif vm.state == 'FAILED' %} + {{vm.state}} + {% else %} + {{vm.state}} + {% endif %} + + + +
+ + {% if is_paginated %} + + {% endif %} +
+ +
+
+ +
+{% endcomment %} {%endblock%} From df97a16a26d1ac600308dd752c9aca2ac4f55fe8 Mon Sep 17 00:00:00 2001 From: Arvind Tiwari Date: Wed, 16 Aug 2017 04:14:46 +0530 Subject: [PATCH 30/42] removed old markup --- .../templates/hosting/virtual_machines.html | 86 ------------------- 1 file changed, 86 deletions(-) diff --git a/hosting/templates/hosting/virtual_machines.html b/hosting/templates/hosting/virtual_machines.html index c792bc08..6964fb3a 100644 --- a/hosting/templates/hosting/virtual_machines.html +++ b/hosting/templates/hosting/virtual_machines.html @@ -70,90 +70,4 @@
{% endif %}
- -{% comment %} -
-
-
-
- -

{% trans "Virtual Machines"%}

-
-
- {% if messages %} -
- {% for message in messages %} - {{ message }} - {% endfor %} -
- {% endif %} -
- {% if not error %} -

- {% trans "Create VM"%} -

-
- - - - - - - - - - - - {% for vm in vms %} - - - {% if vm.ipv6 %} - - - - {% endif %} - - - - - {% endfor %} - - {% endif %} -
{% trans "ID"%}{% trans "Ipv4"%}{% trans "Ipv6"%}{% trans "Status"%}
{{vm.vm_id}}{{vm.ipv4}}{{vm.ipv6}} - - {% if vm.state == 'ACTIVE' %} - {{vm.state}} - {% elif vm.state == 'FAILED' %} - {{vm.state}} - {% else %} - {{vm.state}} - {% endif %} - - - -
- - {% if is_paginated %} - - {% endif %} -
- -
-
- -
-{% endcomment %} {%endblock%} From a2229d325052dd54ce785fd65659637c9d9bfdf5 Mon Sep 17 00:00:00 2001 From: Arvind Tiwari Date: Wed, 16 Aug 2017 04:26:17 +0530 Subject: [PATCH 31/42] created translations --- hosting/locale/de/LC_MESSAGES/django.po | 24 ++++++++++++------- hosting/templates/hosting/user_keys.html | 2 +- .../templates/hosting/virtual_machines.html | 10 ++++---- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/hosting/locale/de/LC_MESSAGES/django.po b/hosting/locale/de/LC_MESSAGES/django.po index 39bc4adc..3cc30292 100644 --- a/hosting/locale/de/LC_MESSAGES/django.po +++ b/hosting/locale/de/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-08-11 01:16+0530\n" +"POT-Creation-Date: 2017-08-16 04:19+0530\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -435,17 +435,17 @@ msgstr "Sind Sie sicher, dass Sie ihre virtuelle Maschine beenden wollen " msgid "Virtual Machines" msgstr "Virtuelle Maschinen" -msgid "Create VM" -msgstr "Neue VM" - -msgid "ID" +msgid "To create a new virtual machine, click \"Create VM\"" msgstr "" -msgid "Ipv4" -msgstr "IPv4" +msgid "CREATE VM" +msgstr "NEUE VM" -msgid "Ipv6" -msgstr "IPv6" +msgid "Page" +msgstr "" + +msgid "of" +msgstr "" msgid "login" msgstr "einloggen" @@ -482,6 +482,12 @@ msgid "" "contact Data Center Light Support." msgstr "" +#~ msgid "Ipv4" +#~ msgstr "IPv4" + +#~ msgid "Ipv6" +#~ msgstr "IPv6" + #~ msgid "Close" #~ msgstr "Schliessen" diff --git a/hosting/templates/hosting/user_keys.html b/hosting/templates/hosting/user_keys.html index b66a1f6f..fd93b66f 100644 --- a/hosting/templates/hosting/user_keys.html +++ b/hosting/templates/hosting/user_keys.html @@ -77,7 +77,7 @@