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