From aa13da868e8aeabd48e8238886ee05bf1e4b80a0 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Tue, 6 Jul 2010 13:45:25 +0200 Subject: [PATCH] synccompress update, gitignore fix --- .gitignore | 2 ++ .../management/commands/synccompress.py | 21 ++++++++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index ffdcd2427..a3f95c013 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,8 @@ dev.sqlite # Compress output /wolnelektury/static/css/all.min*.css /wolnelektury/static/js/all*.min.js +/wolnelektury/static/css/book.min*.css +/wolnelektury/static/js/book*.min.js /wolnelektury/static/js/jquery.min.js # Python garbage diff --git a/apps/compress/management/commands/synccompress.py b/apps/compress/management/commands/synccompress.py index f5624f59d..8217979dd 100644 --- a/apps/compress/management/commands/synccompress.py +++ b/apps/compress/management/commands/synccompress.py @@ -6,22 +6,20 @@ from django.conf import settings class Command(NoArgsCommand): option_list = NoArgsCommand.option_list + ( make_option('--force', action='store_true', default=False, help='Force update of all files, even if the source files are older than the current compressed file.'), - make_option('--verbosity', action='store', dest='verbosity', default='1', - type='choice', choices=['0', '1', '2'], - help='Verbosity level; 0=minimal output, 1=normal output, 2=all output'), ) help = 'Updates and compresses CSS and JavsScript on-demand, without restarting Django' args = '' def handle_noargs(self, **options): - + force = options.get('force', False) verbosity = int(options.get('verbosity', 1)) from compress.utils import needs_update, filter_css, filter_js for name, css in settings.COMPRESS_CSS.items(): - u, version = needs_update(css['output_filename'], css['source_filenames']) + u, version = needs_update(css['output_filename'], + css['source_filenames']) if (force or u) or verbosity >= 2: msg = 'CSS Group \'%s\'' % name @@ -36,7 +34,8 @@ class Command(NoArgsCommand): print for name, js in settings.COMPRESS_JS.items(): - u, version = needs_update(js['output_filename'], js['source_filenames']) + u, version = needs_update(js['output_filename'], + js['source_filenames']) if (force or u) or verbosity >= 2: msg = 'JavaScript Group \'%s\'' % name @@ -48,4 +47,12 @@ class Command(NoArgsCommand): filter_js(js, verbosity) if (force or u) or verbosity >= 2: - print \ No newline at end of file + print + +# Backwards compatibility for Django r9110 +if not [opt for opt in Command.option_list if opt.dest=='verbosity']: + Command.option_list += ( + make_option('--verbosity', '-v', action="store", dest="verbosity", + default='1', type='choice', choices=['0', '1', '2'], + help="Verbosity level; 0=minimal output, 1=normal output, 2=all output"), + ) -- 2.20.1