mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-04-29 10:10:19 +00:00
configuration: Fix parsing error in retrieving default app
- some minor refactoring - optimized imports Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
This commit is contained in:
parent
9781cc0cb8
commit
0023481d48
@ -66,7 +66,7 @@ def get_default_app():
|
|||||||
if aug.get(match + "/arg[1]") == '''"^/$"''':
|
if aug.get(match + "/arg[1]") == '''"^/$"''':
|
||||||
app_path = aug.get(match + "/arg[2]")
|
app_path = aug.get(match + "/arg[2]")
|
||||||
|
|
||||||
return app_path.strip("/")
|
return app_path.strip('"').strip('/')
|
||||||
|
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
|
|||||||
@ -19,13 +19,12 @@ FreedomBox views for basic system configuration.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import re
|
|
||||||
|
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.template.response import TemplateResponse
|
from django.template.response import TemplateResponse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
from plinth import action_utils, actions, frontpage
|
from plinth import actions, frontpage
|
||||||
from plinth.modules import config, firewall
|
from plinth.modules import config, firewall
|
||||||
from plinth.modules.names import SERVICES
|
from plinth.modules.names import SERVICES
|
||||||
from plinth.signals import (domain_added, domain_removed, domainname_change,
|
from plinth.signals import (domain_added, domain_removed, domainname_change,
|
||||||
@ -38,7 +37,7 @@ LOGGER = logging.getLogger(__name__)
|
|||||||
|
|
||||||
def index(request):
|
def index(request):
|
||||||
"""Serve the configuration form"""
|
"""Serve the configuration form"""
|
||||||
status = get_status(request)
|
status = get_status()
|
||||||
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
form = ConfigurationForm(request.POST, initial=status,
|
form = ConfigurationForm(request.POST, initial=status,
|
||||||
@ -46,7 +45,7 @@ def index(request):
|
|||||||
# pylint: disable-msg=E1101
|
# pylint: disable-msg=E1101
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
_apply_changes(request, status, form.cleaned_data)
|
_apply_changes(request, status, form.cleaned_data)
|
||||||
status = get_status(request)
|
status = get_status()
|
||||||
form = ConfigurationForm(initial=status, prefix='configuration')
|
form = ConfigurationForm(initial=status, prefix='configuration')
|
||||||
else:
|
else:
|
||||||
form = ConfigurationForm(initial=status, prefix='configuration')
|
form = ConfigurationForm(initial=status, prefix='configuration')
|
||||||
@ -59,7 +58,7 @@ def index(request):
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def get_status(request):
|
def get_status():
|
||||||
"""Return the current status"""
|
"""Return the current status"""
|
||||||
return {
|
return {
|
||||||
'hostname': config.get_hostname(),
|
'hostname': config.get_hostname(),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user