summaryrefslogtreecommitdiff
path: root/compressor
diff options
context:
space:
mode:
authorMathieu Pillard <m@virgule.net>2013-03-08 14:18:46 +0100
committerMathieu Pillard <m@virgule.net>2013-03-08 14:18:46 +0100
commite8efd9c6e9c3a9a100ff6c86529e98091ff05ef3 (patch)
tree644fe2dff9dd439c7392203302d2736345e6b681 /compressor
parent45099731031fc36ec13693c6a6c554f770498a3b (diff)
downloaddjango-compressor-e8efd9c6e9c3a9a100ff6c86529e98091ff05ef3.tar.gz
Remove old python 2.5 compatibility functions as we are dropping 2.5 support
Diffstat (limited to 'compressor')
-rw-r--r--compressor/management/commands/compress.py3
-rw-r--r--compressor/management/commands/mtime_cache.py3
-rw-r--r--compressor/utils/__init__.py29
3 files changed, 2 insertions, 33 deletions
diff --git a/compressor/management/commands/compress.py b/compressor/management/commands/compress.py
index b1096a7..1ae0778 100644
--- a/compressor/management/commands/compress.py
+++ b/compressor/management/commands/compress.py
@@ -29,7 +29,6 @@ from compressor.cache import get_offline_hexdigest, write_offline_manifest
from compressor.conf import settings
from compressor.exceptions import OfflineGenerationError
from compressor.templatetags.compress import CompressorNode
-from compressor.utils import walk, any
def patched_render(self, context):
@@ -199,7 +198,7 @@ class Command(NoArgsCommand):
log.write("Considering paths:\n\t" + "\n\t".join(paths) + "\n")
templates = set()
for path in paths:
- for root, dirs, files in walk(path,
+ for root, dirs, files in os.walk(path,
followlinks=options.get('followlinks', False)):
templates.update(os.path.join(root, name)
for name in files if not name.startswith('.') and
diff --git a/compressor/management/commands/mtime_cache.py b/compressor/management/commands/mtime_cache.py
index 842ad08..bfea571 100644
--- a/compressor/management/commands/mtime_cache.py
+++ b/compressor/management/commands/mtime_cache.py
@@ -6,7 +6,6 @@ from django.core.management.base import NoArgsCommand, CommandError
from compressor.conf import settings
from compressor.cache import cache, get_mtime, get_mtime_cachekey
-from compressor.utils import walk
class Command(NoArgsCommand):
@@ -58,7 +57,7 @@ class Command(NoArgsCommand):
files_to_add = set()
keys_to_delete = set()
- for root, dirs, files in walk(settings.COMPRESS_ROOT, followlinks=options['follow_links']):
+ for root, dirs, files in os.walk(settings.COMPRESS_ROOT, followlinks=options['follow_links']):
for dir_ in dirs:
if self.is_ignored(dir_):
dirs.remove(dir_)
diff --git a/compressor/utils/__init__.py b/compressor/utils/__init__.py
index 8aec054..83a1a2a 100644
--- a/compressor/utils/__init__.py
+++ b/compressor/utils/__init__.py
@@ -1,37 +1,8 @@
# -*- coding: utf-8 -*-
import os
-import sys
from compressor.exceptions import FilterError
-if sys.version_info < (2, 5):
- # Add any http://docs.python.org/library/functions.html?#any to Python < 2.5
- def any(seq):
- for item in seq:
- if item:
- return True
- return False
-
-else:
- any = any
-
-
-if sys.version_info < (2, 6):
- def walk(root, topdown=True, onerror=None, followlinks=False):
- """
- A version of os.walk that can follow symlinks for Python < 2.6
- """
- for dirpath, dirnames, filenames in os.walk(root, topdown, onerror):
- yield (dirpath, dirnames, filenames)
- if followlinks:
- for d in dirnames:
- p = os.path.join(dirpath, d)
- if os.path.islink(p):
- for link_dirpath, link_dirnames, link_filenames in walk(p):
- yield (link_dirpath, link_dirnames, link_filenames)
-else:
- from os import walk
-
def get_class(class_string, exception=FilterError):
"""