Skip to content
Snippets Groups Projects
Commit 5db8863e authored by Samuel GAIST's avatar Samuel GAIST Committed by Flavio TARSETTI
Browse files

[experiments][management][commands] Pre-commit cleanup

parent b9e6314e
No related branches found
No related tags found
2 merge requests!353Cleanup experiments,!342Django 3 migration
......@@ -27,37 +27,45 @@
import logging
logger = logging.getLogger(__name__)
from django.core.management.base import BaseCommand
from ... import utils
logger = logging.getLogger(__name__)
class Command(BaseCommand):
help = 'Sets and resets queue configurations'
help = "Sets and resets queue configurations"
def add_arguments(self, parser):
parser.add_argument('--delete', action='store_true', dest='delete',
default=False, help='Really deletes the CachedFiles - ' \
'otherwise only displays what would be deleted')
parser.add_argument(
"--delete",
action="store_true",
dest="delete",
default=False,
help="Really deletes the CachedFiles - "
"otherwise only displays what would be deleted",
)
def handle(self, *ignored, **arguments):
# Setup this command's logging level
global logger
arguments['verbosity'] = int(arguments['verbosity'])
if arguments['verbosity'] >= 1:
if arguments['verbosity'] == 1: logger.setLevel(logging.INFO)
elif arguments['verbosity'] >= 2: logger.setLevel(logging.DEBUG)
arguments["verbosity"] = int(arguments["verbosity"])
if arguments["verbosity"] >= 1:
if arguments["verbosity"] == 1:
logger.setLevel(logging.INFO)
elif arguments["verbosity"] >= 2:
logger.setLevel(logging.DEBUG)
if arguments['delete']:
if arguments["delete"]:
utils.cleanup_orphaned_cachedfiles()
else:
l = utils.list_orphaned_cachedfiles()
for c in l: print(c)
print('%d CachedFiles are unreacheable' % len(l))
orphaned_files = utils.list_orphaned_cachedfiles()
for file_ in orphaned_files:
print(file_)
print("%d CachedFiles are unreacheable" % len(orphaned_files))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment