Services: minor cleanup

- remove Service.description (not used anymore)
- remove datetime template (use default service.html instead)
This commit is contained in:
fonfon 2016-04-27 20:27:22 +00:00 committed by James Valleroy
parent 398e6d7b14
commit 895f329654
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
4 changed files with 5 additions and 33 deletions

View File

@ -1,25 +0,0 @@
{% extends "service.html" %}
{% comment %}
#
# This file is part of Plinth.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
{% endcomment %}
{% block diagnostics %}
<p>
{% include "diagnostics_button.html" with module="datetime" %}
</p>
{% endblock %}

View File

@ -35,7 +35,7 @@ class DateTimeServiceView(ServiceView):
description = datetime.description
form_class = DateTimeForm
service_id = datetime.managed_services[0]
template_name = "datetime.html"
diagnostics_module_name = "datetime"
def get_initial(self):
return {'is_enabled': self.service.is_enabled(),

View File

@ -39,16 +39,14 @@ class Service(object):
- service_id: unique service name. If possible this should be the name of
the service on operating system level (as in /etc/init.d/).
- name: service name as to be displayed in the GUI
- description (optional): list of paragraphs that describe the service
- is_enabled (optional): Boolean, or a Function returning Boolean
- enable (optional): Function
- disable (optional): Function
- is_running (optional): Boolean, or a Function returning Boolean
"""
def __init__(self, service_id, name, ports=None, description=None,
is_external=False, is_enabled=None, enable=None, disable=None,
is_running=None):
def __init__(self, service_id, name, ports=None, is_external=False,
is_enabled=None, enable=None, disable=None, is_running=None):
if ports is None:
ports = [service_id]
@ -57,7 +55,6 @@ class Service(object):
self.service_id = service_id
self.name = name
self.description = description
self.ports = ports
self.is_external = is_external
self._is_enabled = is_enabled

View File

@ -38,7 +38,7 @@ def index(request):
class ServiceView(FormView):
"""A generic view for configuring simple modules."""
"""A generic view for configuring simple services."""
service_id = None
form_class = forms.ServiceForm
template_name = 'service.html'
@ -70,7 +70,7 @@ class ServiceView(FormView):
return service
def get_initial(self):
"""Return the status of the module to fill in the form."""
"""Return the status of the service to fill in the form."""
return {'is_enabled': self.service.is_enabled(),
'is_running': self.service.is_running()}