diff --git a/backend/backend.py b/backend/backend.py index d0a962a1..b29edea7 100644 --- a/backend/backend.py +++ b/backend/backend.py @@ -310,7 +310,10 @@ def api_watch_add(): global messages # @todo add_watch should throw a custom Exception for validation etc - datastore.add_watch(url=request.form.get('url').strip(), tag=request.form.get('tag').strip()) + new_uuid = datastore.add_watch(url=request.form.get('url').strip(), tag=request.form.get('tag').strip()) + # Straight into the queue. + update_q.put(new_uuid) + messages.append({'class': 'ok', 'message': 'Watch added.'}) return redirect(url_for('main_page')) diff --git a/backend/store.py b/backend/store.py index c8cc5618..fa399796 100644 --- a/backend/store.py +++ b/backend/store.py @@ -128,15 +128,16 @@ class ChangeDetectionStore: validators.url(url) # @todo use a common generic version of this - + new_uuid = str(uuid_builder.uuid4()) _blank = self.generic_definition.copy() _blank.update({ 'url': url, 'tag': tag, - 'uuid': str(uuid_builder.uuid4()) + 'uuid': new_uuid }) self.data['watching'].update({_blank['uuid']: _blank}) + return new_uuid def sync_to_json(self):