Made the CSSTidyFilter function.
Signed-off-by: Jannis Leidel <jannis@leidel.info>
This commit is contained in:
committed by
Jannis Leidel
parent
7255025f11
commit
9e148cdd90
1
AUTHORS
1
AUTHORS
@@ -3,6 +3,7 @@ Christian Metts
|
|||||||
Django Compressor's filters started life as the filters from Andreas Pelme's
|
Django Compressor's filters started life as the filters from Andreas Pelme's
|
||||||
django-compress.
|
django-compress.
|
||||||
|
|
||||||
|
Aaron Godfrey
|
||||||
Atamert Ölçgen
|
Atamert Ölçgen
|
||||||
Ben Spaulding
|
Ben Spaulding
|
||||||
Brad Whittington
|
Brad Whittington
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import os
|
from subprocess import Popen, PIPE
|
||||||
import warnings
|
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import warnings
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
@@ -18,16 +18,17 @@ class CSSTidyFilter(FilterBase):
|
|||||||
tmp_file.flush()
|
tmp_file.flush()
|
||||||
|
|
||||||
output_file = tempfile.NamedTemporaryFile(mode='w+b')
|
output_file = tempfile.NamedTemporaryFile(mode='w+b')
|
||||||
|
|
||||||
command = '%s %s %s %s' % (BINARY, tmp_file.name, ARGUMENTS, output_file.name)
|
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()
|
filtered_css = output_file.read()
|
||||||
output_file.close()
|
output_file.close()
|
||||||
tmp_file.close()
|
tmp_file.close()
|
||||||
|
|
||||||
if self.verbose:
|
if self.verbose:
|
||||||
print command_output
|
print command_output
|
||||||
|
|
||||||
return filtered_css
|
return filtered_css
|
||||||
|
|||||||
Reference in New Issue
Block a user