diff --git a/plinth/module_loader.py b/plinth/module_loader.py index bbf7a0b4a..a09c6a80a 100644 --- a/plinth/module_loader.py +++ b/plinth/module_loader.py @@ -142,9 +142,12 @@ def get_modules_to_load(): modules = [] module_directory = os.path.join(cfg.config_dir, 'modules-enabled') - # omit hidden files - file_names = [f for f in os.listdir(module_directory) if not - f.startswith(".")] + + # Omit hidden files + file_names = [file + for file in os.listdir(module_directory) + if not file.startswith('.')] + for file_name in file_names: full_file_name = os.path.join(module_directory, file_name) with open(full_file_name, 'r') as file: diff --git a/plinth/modules/first_boot/forms.py b/plinth/modules/first_boot/forms.py index 7fd60ad1a..5b55574db 100644 --- a/plinth/modules/first_boot/forms.py +++ b/plinth/modules/first_boot/forms.py @@ -25,29 +25,29 @@ than 63 characters in length.'), class Meta: model = auth.models.User - fields = ("hostname", "username", "password") + fields = ('hostname', 'username', 'password') widgets = { 'password': forms.PasswordInput, } help_texts = { - 'username': 'Choose a username and password to access this web\ - interface. The password can be changed and other users can\ - be added later.', + 'username': _('Choose a username and password to access this web\ + interface. The password can be changed and other users can be added later.'), } def save(self, commit=True): """Set hostname, create and login the user""" config.set_hostname(self.cleaned_data['hostname']) user = super(State0Form, self).save(commit=False) - user.set_password(self.cleaned_data["password"]) + user.set_password(self.cleaned_data['password']) user.is_expert = True if commit: user.save() self.login_user() + return user def login_user(self): - """Try to login the user with the credentials he provided""" + """Try to login the user with the credentials provided""" try: user = auth.authenticate(username=self.request.POST['username'], password=self.request.POST['password']) @@ -55,5 +55,5 @@ than 63 characters in length.'), except Exception: pass else: - msg = _('User account created, you are now logged in') - messages.success(self.request, msg) + message = _('User account created, you are now logged in') + messages.success(self.request, message) diff --git a/plinth/modules/first_boot/middleware.py b/plinth/modules/first_boot/middleware.py index de8c5bc76..d97559445 100644 --- a/plinth/modules/first_boot/middleware.py +++ b/plinth/modules/first_boot/middleware.py @@ -35,6 +35,7 @@ class FirstBootMiddleware(object): @staticmethod def process_request(request): + """Handle a request as Django middleware request handler.""" state = kvstore.get_default('firstboot_state', 0) firstboot_index_url = reverse('first_boot:index') user_requests_firstboot = request.path.startswith(firstboot_index_url) diff --git a/plinth/modules/first_boot/static/state0.css b/plinth/modules/first_boot/static/state0.css index d1f95b4ba..6f351942b 100644 --- a/plinth/modules/first_boot/static/state0.css +++ b/plinth/modules/first_boot/static/state0.css @@ -1,11 +1,13 @@ +/* TODO: remove this when we stop putting everything in a hero unit */ form .control-label { font-size: large; } + form .help-block { font-size: small; } + /* TODO: remove this customization once we use bootstrap3 */ .has-error span.help-block { - background-color: red; + color: red; } - diff --git a/plinth/modules/first_boot/templates/firstboot_state0.html b/plinth/modules/first_boot/templates/firstboot_state0.html index 39074bbea..d55c70756 100644 --- a/plinth/modules/first_boot/templates/firstboot_state0.html +++ b/plinth/modules/first_boot/templates/firstboot_state0.html @@ -29,8 +29,8 @@
It looks like this FreedomBox isn't set up yet. We - need to ask you a few questions to get started.
+It looks like this {{ cfg.box_name }} isn't set up yet. Provide basic + data to get started.