Commit 21f2d05a authored by Thomas Goirand's avatar Thomas Goirand

Removed 0001-Use-argparse-instead-of-optparse.patch (applied upstream).

parent 7d5098bd
......@@ -20,6 +20,7 @@ python-django-compressor (2.1.1-1) experimental; urgency=medium
[ Thomas Goirand ]
* New upstream release.
* Removed transition packages and remove all versions in (b-)d.
* Removed 0001-Use-argparse-instead-of-optparse.patch (applied upstream).
-- Thomas Goirand <zigo@debian.org> Mon, 09 Oct 2017 23:15:11 +0200
......
Description: Fixing 1.10 compatibility issues relating to Django's
dropping of optparse in favour of argparse.
Author: James Addison <addi00+github.com@gmail.com>
Date: Tue, 19 Jul 2016 02:32:36 +0300
Origin: https://github.com/django-compressor/django-compressor/commit/e86ccfd29c3a4695f315637295c3d5ab20484e6c
Last-Update: 2016-07-19
diff --git a/compressor/management/commands/compress.py b/compressor/management/commands/compress.py
index a6fb1a1..a05e991 100644
--- a/compressor/management/commands/compress.py
+++ b/compressor/management/commands/compress.py
@@ -4,7 +4,6 @@ import sys
from collections import OrderedDict
from fnmatch import fnmatch
-from optparse import make_option
from importlib import import_module
import django
@@ -36,23 +35,23 @@ else:
class Command(BaseCommand):
help = "Compress content outside of the request/response cycle"
- option_list = BaseCommand.option_list + (
- make_option('--extension', '-e', action='append', dest='extensions',
- help='The file extension(s) to examine (default: ".html", '
- 'separate multiple extensions with commas, or use -e '
- 'multiple times)'),
- make_option('-f', '--force', default=False, action='store_true',
- help="Force the generation of compressed content even if the "
- "COMPRESS_ENABLED setting is not True.", dest='force'),
- make_option('--follow-links', default=False, action='store_true',
- help="Follow symlinks when traversing the COMPRESS_ROOT "
- "(which defaults to STATIC_ROOT). Be aware that using this "
- "can lead to infinite recursion if a link points to a parent "
- "directory of itself.", dest='follow_links'),
- make_option('--engine', default="django", action="store",
- help="Specifies the templating engine. jinja2 or django",
- dest="engine"),
- )
+
+ def add_arguments(self, parser):
+ parser.add_argument('--extension', '-e', action='append', dest='extensions',
+ help='The file extension(s) to examine (default: ".html", '
+ 'separate multiple extensions with commas, or use -e '
+ 'multiple times)')
+ parser.add_argument('-f', '--force', default=False, action='store_true',
+ help="Force the generation of compressed content even if the "
+ "COMPRESS_ENABLED setting is not True.", dest='force')
+ parser.add_argument('--follow-links', default=False, action='store_true',
+ help="Follow symlinks when traversing the COMPRESS_ROOT "
+ "(which defaults to STATIC_ROOT). Be aware that using this "
+ "can lead to infinite recursion if a link points to a parent "
+ "directory of itself.", dest='follow_links')
+ parser.add_argument('--engine', default="django", action="store",
+ help="Specifies the templating engine. jinja2 or django",
+ dest="engine")
def get_loaders(self):
template_source_loaders = []
@@ -107,10 +106,11 @@ class Command(BaseCommand):
verbosity = int(options.get("verbosity", 0))
if not log:
log = StringIO()
- if not settings.TEMPLATE_LOADERS:
+ if not self.get_loaders():
raise OfflineGenerationError("No template loaders defined. You "
"must set TEMPLATE_LOADERS in your "
- "settings.")
+ "settings or set 'loaders' in your "
+ "TEMPLATES dictionary.")
templates = set()
if engine == 'django':
paths = set()
@@ -273,7 +273,7 @@ class Command(BaseCommand):
ext_list[i] = '.%s' % ext_list[i]
return set(ext_list)
- def handle(self, **options):
+ def handle(self, *args, **options):
if not settings.COMPRESS_ENABLED and not options.get("force"):
raise CommandError(
"Compressor is disabled. Set the COMPRESS_ENABLED "
--
2.1.4
0001-Use-argparse-instead-of-optparse.patch
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment