From 05f52bbdeb87fe49ce99e25c4290cce427551a4b Mon Sep 17 00:00:00 2001 From: Joel Collins Date: Mon, 18 Feb 2019 11:30:38 +0000 Subject: [PATCH] Process all initial tags in one call --- .../api/v1/blueprints/camera/capture.py | 4 +--- openflexure_microscope/camera/capture.py | 12 +++++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/openflexure_microscope/api/v1/blueprints/camera/capture.py b/openflexure_microscope/api/v1/blueprints/camera/capture.py index 56557f07..80ebed34 100644 --- a/openflexure_microscope/api/v1/blueprints/camera/capture.py +++ b/openflexure_microscope/api/v1/blueprints/camera/capture.py @@ -128,9 +128,7 @@ class ListAPI(MicroscopeView): bayer=bayer) output.put_metadata(metadata) - - for tag in tags: - output.put_tag(str(tag)) + output.put_tags(tags) return jsonify(output.state) diff --git a/openflexure_microscope/camera/capture.py b/openflexure_microscope/camera/capture.py index 45f0d50d..77cac513 100644 --- a/openflexure_microscope/camera/capture.py +++ b/openflexure_microscope/camera/capture.py @@ -264,16 +264,18 @@ class CaptureObject(object): return False # HANDLE TAGS - def put_tag(self, tag: str): + def put_tags(self, tags: list): """ Add a new tag to the ``tags`` list attribute. Args: - tag (str): Tag to be added + tag (list): List of tags to be added """ - if not tag in self.tags: - self.tags.append(tag) - self.save_metadata() + for tag in tags: + if not tag in self.tags: + self.tags.append(tag) + + self.save_metadata() def delete_tag(self, tag: str): """