Made the CSSTidyFilter function.

Signed-off-by: Jannis Leidel <jannis@leidel.info>
This commit is contained in:
Aaron Godfrey
2010-01-15 11:00:38 -05:00
committed by Jannis Leidel
parent 7255025f11
commit 9e148cdd90
2 changed files with 10 additions and 8 deletions

View File

@@ -3,6 +3,7 @@ Christian Metts
Django Compressor's filters started life as the filters from Andreas Pelme's
django-compress.
Aaron Godfrey
Atamert Ölçgen
Ben Spaulding
Brad Whittington

View File

@@ -1,6 +1,6 @@
import os
import warnings
from subprocess import Popen, PIPE
import tempfile
import warnings
from django.conf import settings
@@ -18,16 +18,17 @@ class CSSTidyFilter(FilterBase):
tmp_file.flush()
output_file = tempfile.NamedTemporaryFile(mode='w+b')
command = '%s %s %s %s' % (BINARY, tmp_file.name, ARGUMENTS, output_file.name)
command_output = os.popen(command).read()
command_output = Popen(command, shell=True,
stdout=PIPE, stdin=PIPE, stderr=PIPE).communicate()
filtered_css = output_file.read()
output_file.close()
tmp_file.close()
if self.verbose:
print command_output
return filtered_css