From 29514cc2d2c482db3cc4fb367e2b07bd67eaf4af Mon Sep 17 00:00:00 2001 From: bmedx Date: Mon, 4 Dec 2017 10:13:26 -0500 Subject: [PATCH] Update clear_collectstatic_cache management command to Django 1.11 spec --- .../commands/clear_collectstatic_cache.py | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/common/djangoapps/static_replace/management/commands/clear_collectstatic_cache.py b/common/djangoapps/static_replace/management/commands/clear_collectstatic_cache.py index 02e0c2b7b3..6d6108a198 100644 --- a/common/djangoapps/static_replace/management/commands/clear_collectstatic_cache.py +++ b/common/djangoapps/static_replace/management/commands/clear_collectstatic_cache.py @@ -1,14 +1,21 @@ -### -### Script for importing courseware from XML format -### +""" +Django management command to clear the 'staticfiles' Django cache +""" -from django.core.management.base import NoArgsCommand +from __future__ import print_function + +from django.core.management.base import BaseCommand from django.core.cache import caches -class Command(NoArgsCommand): - help = 'Import the specified data directory into the default ModuleStore' +class Command(BaseCommand): + """ + Implementation of the management command + """ - def handle_noargs(self, **options): + help = 'Empties the Django caches["staticfiles"] cache.' + + def handle(self, *args, **_): staticfiles_cache = caches['staticfiles'] staticfiles_cache.clear() + print("Cache cleared.")