Skip to content

Commit 15c225b

Browse files
committed
Made the soup a property of the compressor to lower the compressor startup time since the soup is not always required.
1 parent 4caa91f commit 15c225b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

compressor/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ def __init__(self, content, output_prefix="compressed"):
3535
self.type = None
3636
self.output_prefix = output_prefix
3737
self.split_content = []
38-
self.soup = BeautifulSoup(self.content)
3938

4039
def split_contents(self):
4140
raise NotImplementedError('split_contents must be defined in a subclass')
@@ -48,6 +47,10 @@ def get_filename(self, url):
4847
raise UncompressableFileError('"%s" does not exist' % self.storage.path(basename))
4948
return self.storage.path(basename)
5049

50+
@property
51+
def soup(self):
52+
return BeautifulSoup(self.content)
53+
5154
@property
5255
def mtimes(self):
5356
return [os.path.getmtime(h[1]) for h in self.split_contents() if h[0] == 'file']

0 commit comments

Comments
 (0)