summaryrefslogtreecommitdiff
path: root/morphlib/morphologyfactory.py
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2014-11-06 16:41:23 +0000
committerSam Thursfield <sam.thursfield@codethink.co.uk>2014-11-06 16:41:23 +0000
commit8f47d014bd8946acc67e6fd291a91028ba6c6a08 (patch)
tree00235a3e6eb9b38627960e51103392f0f5c5ec24 /morphlib/morphologyfactory.py
parent6779e46e880eec757a6923441accef2442007677 (diff)
downloadmorph-8f47d014bd8946acc67e6fd291a91028ba6c6a08.tar.gz
Remove one place where we pass the Application instance around
The MorphologyFactory class only uses the status() function of the morphlib.Application instance that it gets passed. So make it require only a status callback.
Diffstat (limited to 'morphlib/morphologyfactory.py')
-rw-r--r--morphlib/morphologyfactory.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/morphlib/morphologyfactory.py b/morphlib/morphologyfactory.py
index b0a0528d..dad7238e 100644
--- a/morphlib/morphologyfactory.py
+++ b/morphlib/morphologyfactory.py
@@ -41,14 +41,13 @@ class MorphologyFactory(object):
'''A way of creating morphologies which will provide a default'''
- def __init__(self, local_repo_cache, remote_repo_cache=None, app=None):
+ def __init__(self, local_repo_cache, remote_repo_cache=None,
+ status_cb=None):
self._lrc = local_repo_cache
self._rrc = remote_repo_cache
- self._app = app
- def status(self, *args, **kwargs): # pragma: no cover
- if self._app is not None:
- self._app.status(*args, **kwargs)
+ null_status_function = lambda **kwargs: None
+ self.status = status_cb or null_status_function
def get_morphology(self, reponame, sha1, filename):
morph_name = os.path.splitext(os.path.basename(filename))[0]