firstboot: Indentation & styling fixes

pycodestyle version used is 2.1.0 with default arguments.
This commit is contained in:
Sunil Mohan Adapa authored and James Valleroy committed 2016-12-04 15:24:31 -05:00
1 parent a2d4719685
commit c37aa0fbd5
10 files changed
+75 -253

No files matched your search

+10 -6
View File
@@ -34,11 +34,15 @@ depends = ['system']
managed_packages = ['ldapscripts', 'ldap-utils', 'libnss-ldapd',
'libpam-ldapd', 'nslcd', 'slapd']
first_boot_steps = [{'id': 'users_firstboot',
'url': 'users:firstboot',
'order': 1
},
]
first_boot_steps = [
{
'id': 'users_firstboot',
'url': 'users:firstboot',
'order': 1
},
]
title = _('Users and Groups')
@@ -80,4 +84,4 @@ def _diagnose_ldap_entry(search_item):
pass
return [_('Check LDAP entry "{search_item}"')
.format(search_item=search_item), result]
.format(search_item=search_item), result]
+15 -17
View File
@@ -27,11 +27,9 @@ from django.utils.translation import ugettext as _, ugettext_lazy
from plinth import actions
from plinth.errors import ActionError
from plinth.modules.security import set_restricted_access
# Usernames used by optional services (that might not be installed yet).
RESERVED_USERNAMES = [
'debian-deluged',
'Debian-minetest',
@@ -95,14 +93,14 @@ class CreateUserForm(ValidNewUsernameCheckMixin, UserCreationForm):
label=ugettext_lazy('Groups'),
required=False,
widget=forms.CheckboxSelectMultiple,
help_text= \
ugettext_lazy('Select which services should be available to the new '
'user. The user will be able to log in to services that '
'support single sign-on through LDAP, if they are in the '
'appropriate group.<br /><br />Users in the admin group '
'will be able to log in to all services. They can also '
'log in to the system through SSH and have '
'administrative privileges (sudo).'))
help_text=ugettext_lazy(
'Select which services should be available to the new '
'user. The user will be able to log in to services that '
'support single sign-on through LDAP, if they are in the '
'appropriate group.<br /><br />Users in the admin group '
'will be able to log in to all services. They can also '
'log in to the system through SSH and have '
'administrative privileges (sudo).'))
def __init__(self, request, *args, **kwargs):
"""Initialize the form with extra request argument."""
@@ -132,7 +130,7 @@ class CreateUserForm(ValidNewUsernameCheckMixin, UserCreationForm):
messages.error(
self.request,
_('Failed to add new user to {group} group.')
.format(group=group))
.format(group=group))
group_object, created = Group.objects.get_or_create(name=group)
group_object.user_set.add(user)
@@ -146,12 +144,12 @@ class UserUpdateForm(ValidNewUsernameCheckMixin, forms.ModelForm):
label=ugettext_lazy('SSH Keys'),
required=False,
widget=forms.Textarea,
help_text= \
ugettext_lazy('Setting an SSH public key will allow this user to '
'securely log in to the system without using a '
'password. You may enter multiple keys, one on each '
'line. Blank lines and lines starting with # will be '
'ignored.'))
help_text=ugettext_lazy(
'Setting an SSH public key will allow this user to '
'securely log in to the system without using a '
'password. You may enter multiple keys, one on each '
'line. Blank lines and lines starting with # will be '
'ignored.'))
class Meta:
"""Metadata to control automatic form building."""
+7 -6
View File
@@ -22,13 +22,13 @@ from django.contrib.messages.views import SuccessMessageMixin
from django.urls import reverse, reverse_lazy
from django.views.generic.edit import (CreateView, DeleteView, UpdateView,
FormView)
from django.views.generic import ListView, CreateView as CV
import django.views.generic
from django.utils.translation import ugettext as _, ugettext_lazy
from plinth import cfg
from .forms import CreateUserForm, UserChangePasswordForm, UserUpdateForm, State1Form
from .forms import CreateUserForm, UserChangePasswordForm, UserUpdateForm, \
State1Form
from plinth import actions
from plinth import cfg
from plinth.errors import ActionError
from plinth.modules.first_boot.middleware import mark_step_done, next_step
@@ -65,7 +65,7 @@ class UserCreate(ContextMixin, SuccessMessageMixin, CreateView):
return kwargs
class UserList(ContextMixin, ListView):
class UserList(ContextMixin, django.views.generic.ListView):
"""View to list users."""
model = User
template_name = 'users_list.html'
@@ -168,7 +168,7 @@ class UserChangePassword(ContextMixin, SuccessMessageMixin, FormView):
return super(UserChangePassword, self).form_valid(form)
class State1View(CV):
class State1View(django.views.generic.CreateView):
"""Create user account and log the user in."""
template_name = 'firstboot_state1.html'
form_class = State1Form
@@ -178,6 +178,7 @@ class State1View(CV):
"""Initialize the view object."""
if not cfg.danube_edition:
mark_step_done('pagekite_firstboot')
mark_step_done('users_firstboot')
self.success_url = next_step()
return super(State1View, self).__init__(*args, **kwargs)