Sunil Mohan Adapa 2bd33ed428
radicale: Fix issue with parsing new configuration file
The latest version of radicale calendar server's configuration file does not
parse with augeas. This is because it contains the following entry in [headers]
section:

Content-Security-Policy = default-src 'self'; object-src 'none'

The semicolon is treated as comment by the lens which is not correct. Fix this
by overriding comment_re in the lens.

Tests:

- Updated test case works when using augparse.

- With the patch, latest upstream configuration file parses without errors.

- Functional tests work for radicale in testing distribution. Without patch
radicale fails to install.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2026-04-27 19:19:47 -04:00

34 lines
1.0 KiB
Python

# SPDX-License-Identifier: AGPL-3.0-or-later
"""
Views for radicale module.
"""
from django.contrib import messages
from django.utils.translation import gettext_lazy as _
from plinth.views import AppView
from . import privileged
from .forms import RadicaleForm
class RadicaleAppView(AppView):
"""A specialized view for configuring radicale service."""
form_class = RadicaleForm
app_id = 'radicale'
def get_initial(self):
"""Return the values to fill in the form."""
initial = super().get_initial()
initial['access_rights'] = privileged.get_rights_value()
return initial
def form_valid(self, form):
"""Change the access control of Radicale service."""
data = form.cleaned_data
if privileged.get_rights_value() != data['access_rights']:
privileged.configure(data['access_rights'])
messages.success(self.request,
_('Access rights configuration updated'))
return super().form_valid(form)