mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-03-11 09:04:54 +00:00
- Action script: - must not be root when validating directory - return only first validation error - Directory selection form, transmission, deluge: show the download path as it is in the configuration, the path is resolved only on form submit. - Tests: add relative path checks, refactor parametrize code Signed-off-by: Veiko Aasa <veiko17@disroot.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
23 lines
739 B
Python
23 lines
739 B
Python
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
"""
|
|
Forms for Deluge app.
|
|
"""
|
|
|
|
from django.utils.translation import ugettext_lazy as _
|
|
|
|
from plinth.modules.deluge import reserved_usernames
|
|
from plinth.modules.storage.forms import (DirectorySelectForm,
|
|
DirectoryValidator)
|
|
|
|
|
|
class DelugeForm(DirectorySelectForm):
|
|
"""Deluge configuration form"""
|
|
|
|
def __init__(self, *args, **kw):
|
|
validator = DirectoryValidator(username=reserved_usernames[0],
|
|
check_creatable=True)
|
|
super(DelugeForm, self).__init__(
|
|
title=_('Download directory'),
|
|
default='/var/lib/deluged/Downloads', validator=validator, *args,
|
|
**kw)
|