From 15c225b32abfbea5ca71be464edd2ea4e9b69a48 Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Wed, 2 Jun 2010 11:46:38 +0200 Subject: [PATCH] Made the soup a property of the compressor to lower the compressor startup time since the soup is not always required. --- compressor/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compressor/__init__.py b/compressor/__init__.py index d41ddbd..4bd52d5 100644 --- a/compressor/__init__.py +++ b/compressor/__init__.py @@ -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']