mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
snapshot: Format code with yapf
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
4 files changed
+27
-30
No files matched your search
@@ -70,8 +70,8 @@ def setup(helper, old_version=None):
|
||||
|
||||
def load_augeas():
|
||||
"""Initialize Augeas."""
|
||||
aug = augeas.Augeas(flags=augeas.Augeas.NO_LOAD +
|
||||
augeas.Augeas.NO_MODL_AUTOLOAD)
|
||||
aug = augeas.Augeas(
|
||||
flags=augeas.Augeas.NO_LOAD + augeas.Augeas.NO_MODL_AUTOLOAD)
|
||||
|
||||
# shell-script config file lens
|
||||
aug.set('/augeas/load/Shellvars/lens', 'Shellvars.lns')
|
||||
|
||||
@@ -24,16 +24,15 @@ from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
class SnapshotForm(forms.Form):
|
||||
enable_timeline_snapshots = forms.ChoiceField(
|
||||
label=_('Timeline Snapshots'),
|
||||
help_text=_('Enable or disable timeline snapshots '
|
||||
'(hourly, daily, monthly and yearly).'),
|
||||
label=_('Timeline Snapshots'), help_text=_(
|
||||
'Enable or disable timeline snapshots '
|
||||
'(hourly, daily, monthly and yearly).'),
|
||||
choices=[('yes', 'Enabled'), ('no', 'Disabled')])
|
||||
|
||||
enable_software_snapshots = forms.ChoiceField(
|
||||
label=_('Software Installation Snapshots'),
|
||||
help_text=_('Enable or disable snapshots before and after software '
|
||||
'installation'),
|
||||
choices=[('yes', 'Enabled'), ('no', 'Disabled')])
|
||||
label=_('Software Installation Snapshots'), help_text=_(
|
||||
'Enable or disable snapshots before and after software '
|
||||
'installation'), choices=[('yes', 'Enabled'), ('no', 'Disabled')])
|
||||
|
||||
hourly_limit = forms.IntegerField(
|
||||
label=_('Hourly Snapshots Limit'), min_value=0,
|
||||
|
||||
@@ -55,14 +55,13 @@ def index(request):
|
||||
else:
|
||||
form = SnapshotForm(initial=status)
|
||||
|
||||
return TemplateResponse(
|
||||
request, 'snapshot.html', {
|
||||
'title': snapshot_module.name,
|
||||
'description': snapshot_module.description,
|
||||
'manual_page': snapshot_module.manual_page,
|
||||
'subsubmenu': subsubmenu,
|
||||
'form': form
|
||||
})
|
||||
return TemplateResponse(request, 'snapshot.html', {
|
||||
'title': snapshot_module.name,
|
||||
'description': snapshot_module.description,
|
||||
'manual_page': snapshot_module.manual_page,
|
||||
'subsubmenu': subsubmenu,
|
||||
'form': form
|
||||
})
|
||||
|
||||
|
||||
def manage(request):
|
||||
@@ -77,12 +76,11 @@ def manage(request):
|
||||
has_deletable_snapshots = any(
|
||||
[snapshot for snapshot in snapshots[1:] if not snapshot['is_default']])
|
||||
|
||||
return TemplateResponse(
|
||||
request, 'snapshot_manage.html', {
|
||||
'snapshots': snapshots,
|
||||
'has_deletable_snapshots': has_deletable_snapshots,
|
||||
'subsubmenu': subsubmenu,
|
||||
})
|
||||
return TemplateResponse(request, 'snapshot_manage.html', {
|
||||
'snapshots': snapshots,
|
||||
'has_deletable_snapshots': has_deletable_snapshots,
|
||||
'subsubmenu': subsubmenu,
|
||||
})
|
||||
|
||||
|
||||
def update_configuration(request, old_status, new_status):
|
||||
@@ -108,7 +106,8 @@ def update_configuration(request, old_status, new_status):
|
||||
('number_min_age', 'NUMBER_MIN_AGE={}'),
|
||||
]))
|
||||
|
||||
if old_status['enable_software_snapshots'] != new_status['enable_software_snapshots']:
|
||||
if old_status['enable_software_snapshots'] != new_status[
|
||||
'enable_software_snapshots']:
|
||||
if new_status['enable_software_snapshots'] == 'yes':
|
||||
actions.superuser_run('snapshot', ['disable-apt-snapshot', 'no'])
|
||||
else:
|
||||
@@ -130,8 +129,7 @@ def delete(request, number):
|
||||
if request.method == 'POST':
|
||||
actions.superuser_run('snapshot', ['delete', number])
|
||||
messages.success(
|
||||
request,
|
||||
_('Deleted snapshot #{number}.').format(number=number))
|
||||
request, _('Deleted snapshot #{number}.').format(number=number))
|
||||
return redirect(reverse('snapshot:manage'))
|
||||
|
||||
output = actions.superuser_run('snapshot', ['list'])
|
||||
|
||||
Reference in new issue
Block a user