Made the soup a property of the compressor to lower the compressor startup time since the soup is not always required.

This commit is contained in:
Jannis Leidel
2010-06-02 11:46:38 +02:00
parent 4caa91fd9c
commit 15c225b32a

View File

@@ -35,7 +35,6 @@ class Compressor(object):
self.type = None
self.output_prefix = output_prefix
self.split_content = []
self.soup = BeautifulSoup(self.content)
def split_contents(self):
raise NotImplementedError('split_contents must be defined in a subclass')
@@ -48,6 +47,10 @@ class Compressor(object):
raise UncompressableFileError('"%s" does not exist' % self.storage.path(basename))
return self.storage.path(basename)
@property
def soup(self):
return BeautifulSoup(self.content)
@property
def mtimes(self):
return [os.path.getmtime(h[1]) for h in self.split_contents() if h[0] == 'file']