Fixed PEP8 violations
This commit is contained in:
parent
e681b0d8c2
commit
a9c9f74aed
5 changed files with 63 additions and 63 deletions
|
|
@ -1,8 +1,9 @@
|
|||
from oca.pool import WrongNameError, WrongIdError
|
||||
from django.shortcuts import render
|
||||
from django.http import Http404
|
||||
from django.core.urlresolvers import reverse_lazy, reverse
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
from django.views.generic import View, CreateView, FormView, ListView, DetailView,\
|
||||
from django.views.generic import View, CreateView, FormView, ListView, DetailView, \
|
||||
DeleteView, TemplateView, UpdateView
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.contrib import messages
|
||||
|
|
@ -15,9 +16,7 @@ from guardian.mixins import PermissionRequiredMixin
|
|||
from stored_messages.settings import stored_messages_settings
|
||||
from stored_messages.models import Message
|
||||
from stored_messages.api import mark_read
|
||||
from django.utils.safestring import mark_safe>>>>>>> master
|
||||
246
|
||||
|
||||
from django.utils.safestring import mark_safe
|
||||
|
||||
from membership.models import CustomUser, StripeCustomer
|
||||
from utils.stripe_utils import StripeUtils
|
||||
|
|
@ -29,13 +28,11 @@ from .forms import HostingUserSignupForm, HostingUserLoginForm, UserHostingKeyFo
|
|||
from .mixins import ProcessVMSelectionMixin
|
||||
|
||||
from opennebula_api.models import OpenNebulaManager
|
||||
from opennebula_api.serializers import VirtualMachineSerializer,\
|
||||
from opennebula_api.serializers import VirtualMachineSerializer, \
|
||||
VirtualMachineTemplateSerializer
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
|
||||
from oca.pool import WrongNameError, WrongIdError
|
||||
|
||||
CONNECTION_ERROR = "Your VMs cannot be displayed at the moment due to a backend \
|
||||
connection error. please try again in a few minutes."
|
||||
|
||||
|
|
@ -140,7 +137,6 @@ class HostingPricingView(ProcessVMSelectionMixin, View):
|
|||
'templates': templates,
|
||||
'configuration_options': configuration_options,
|
||||
|
||||
|
||||
}
|
||||
|
||||
return context
|
||||
|
|
@ -171,7 +167,6 @@ class IndexView(View):
|
|||
return context
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
|
||||
context = self.get_context_data()
|
||||
|
||||
return render(request, self.template_name, context)
|
||||
|
|
@ -209,15 +204,17 @@ class SignupValidateView(TemplateView):
|
|||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(SignupValidateView, self).get_context_data(**kwargs)
|
||||
login_url = '<a href="' + reverse('hosting:login') + '">' + str(_('login')) +'</a>'
|
||||
login_url = '<a href="' + reverse('hosting:login') + '">' + str(_('login')) + '</a>'
|
||||
home_url = '<a href="' + reverse('datacenterlight:index') + '">Data Center Light</a>'
|
||||
message='{signup_success_message} {lurl}</a> \
|
||||
message = '{signup_success_message} {lurl}</a> \
|
||||
<br />{go_back} {hurl}.'.format(
|
||||
signup_success_message = _('Thank you for signing up. We have sent an email to you. Please follow the instructions in it to activate your account. Once activated, you can login using'),
|
||||
go_back = _('Go back to'),
|
||||
lurl = login_url,
|
||||
hurl = home_url
|
||||
)
|
||||
signup_success_message=_(
|
||||
'Thank you for signing up. We have sent an email to you. '
|
||||
'Please follow the instructions in it to activate your account. Once activated, you can login using'),
|
||||
go_back=_('Go back to'),
|
||||
lurl=login_url,
|
||||
hurl=home_url
|
||||
)
|
||||
context['message'] = mark_safe(message)
|
||||
context['section_title'] = _('Sign up')
|
||||
return context
|
||||
|
|
@ -229,20 +226,20 @@ class SignupValidatedView(SignupValidateView):
|
|||
def get_context_data(self, **kwargs):
|
||||
context = super(SignupValidateView, self).get_context_data(**kwargs)
|
||||
validated = CustomUser.validate_url(self.kwargs['validate_slug'])
|
||||
login_url = '<a href="' + reverse('hosting:login') + '">' + str(_('login')) +'</a>'
|
||||
section_title=_('Account activation')
|
||||
login_url = '<a href="' + reverse('hosting:login') + '">' + str(_('login')) + '</a>'
|
||||
section_title = _('Account activation')
|
||||
if validated:
|
||||
message='{account_activation_string} <br /> {login_string} {lurl}.'.format(
|
||||
account_activation_string = _("Your account has been activated."),
|
||||
login_string = _("You can now"),
|
||||
lurl = login_url)
|
||||
message = '{account_activation_string} <br /> {login_string} {lurl}.'.format(
|
||||
account_activation_string=_("Your account has been activated."),
|
||||
login_string=_("You can now"),
|
||||
lurl=login_url)
|
||||
else:
|
||||
home_url = '<a href="' + reverse('datacenterlight:index') + '">Data Center Light</a>'
|
||||
message = '{sorry_message} <br />{go_back_to} {hurl}'.format(
|
||||
sorry_message = _("Sorry. Your request is invalid."),
|
||||
go_back_to = _('Go back to'),
|
||||
hurl = home_url
|
||||
)
|
||||
sorry_message=_("Sorry. Your request is invalid."),
|
||||
go_back_to=_('Go back to'),
|
||||
hurl=home_url
|
||||
)
|
||||
context['message'] = mark_safe(message)
|
||||
context['section_title'] = section_title
|
||||
return context
|
||||
|
|
@ -545,7 +542,7 @@ class PaymentVMView(LoginRequiredMixin, FormView):
|
|||
return render(request, self.template_name, context)
|
||||
# For now just get first one
|
||||
user_key = UserHostingKey.objects.filter(
|
||||
user=self.request.user).first()
|
||||
user=self.request.user).first()
|
||||
|
||||
# Create a vm using logged user
|
||||
vm_id = manager.create_vm(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue