pylint and spelling fixes

This commit is contained in:
James Valleroy 2017-07-18 21:26:49 -04:00
parent 1069f84154
commit 3ea5868ec1
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
3 changed files with 24 additions and 20 deletions

View File

@ -23,11 +23,12 @@ Configuration helper for Let's Encrypt.
import argparse
import json
import os
import shutil
import subprocess
import sys
import re
import configobj
import shutil
from plinth import action_utils
from plinth.modules.config import config
@ -141,7 +142,7 @@ def get_validity_status(domain):
output = subprocess.check_output(['certbot', 'certificates', '-d', domain])
output = output.decode(sys.stdout.encoding)
match = re.search('INVALID: (.*)\)', output)
match = re.search(r'INVALID: (.*)\)', output)
if match is not None:
validity = match.group(1).lower()
elif re.search('VALID', output) is not None:
@ -194,7 +195,7 @@ def subcommand_revoke(arguments):
process = subprocess.Popen(command, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
stdout, stderr = process.communicate()
_, stderr = process.communicate()
if process.returncode:
print(stderr.decode(), file=sys.stderr)
sys.exit(1)
@ -216,7 +217,7 @@ def subcommand_obtain(arguments):
process = subprocess.Popen(command, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
stdin, stderr = process.communicate()
_, stderr = process.communicate()
if process.returncode:
print(stderr.decode(), file=sys.stderr)
sys.exit(1)
@ -390,7 +391,7 @@ def subcommand_delete(arguments):
command = ['certbot', 'delete', '--cert-name', domain]
process = subprocess.Popen(command, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
stdout, stderr = process.communicate()
_, stderr = process.communicate()
if process.returncode:
print(stderr.decode(), file=sys.stderr)
sys.exit(1)

View File

@ -160,11 +160,11 @@
{% if status.current_domain.name %}
{% blocktrans with current_domain=status.current_domain.name %}
Let Plinth manage certificate renewal of
<b>{{ current_domain }}</b> (recommmended)
<b>{{ current_domain }}</b> (recommended)
{% endblocktrans %}
{% else %}
{% blocktrans with current_domain=status.current_domain.name %}
Let Plinth manage certificate renewal of the current domain (recommmended)
Let Plinth manage certificate renewal of the current domain (recommended)
{% endblocktrans %}
{% endif %}
</span>

View File

@ -19,14 +19,15 @@
Plinth module for using Let's Encrypt.
"""
import json
import logging
from django.contrib import messages
from django.shortcuts import redirect
from django.template.response import TemplateResponse
from django.urls import reverse_lazy
from django.utils.translation import ugettext as _
from django.views.decorators.http import require_POST
import json
import logging
from plinth import actions
from plinth.errors import ActionError
@ -138,10 +139,12 @@ def get_status():
status = actions.superuser_run('letsencrypt', ['get-status'])
status = json.loads(status)
curr_dom = config.get_domainname()
current_domain = {'name': curr_dom,
'has_cert': curr_dom in status['domains'] and
status['domains'][curr_dom]['certificate_available'],
'manage_hooks_enabled': _hooks_manage_enabled()}
current_domain = {
'name': curr_dom,
'has_cert': (curr_dom in status['domains'] and
status['domains'][curr_dom]['certificate_available']),
'manage_hooks_enabled': _hooks_manage_enabled()
}
status['current_domain'] = current_domain
for domain_type, domains in names.domains.items():
@ -156,10 +159,10 @@ def get_status():
def _hooks_manage_enabled():
"""Return status of hook management for current domain."""
try:
output = actions.superuser_run('letsencrypt',
['manage_hooks', 'status'])
except ActionError:
return False
return output.strip() == 'enabled'
"""Return status of hook management for current domain."""
try:
output = actions.superuser_run('letsencrypt',
['manage_hooks', 'status'])
except ActionError:
return False
return output.strip() == 'enabled'