superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject [incubator-superset] branch lyftga updated: Do not add tag to non-saved objects (#7266)
Date Wed, 10 Apr 2019 03:51:47 GMT
This is an automated email from the ASF dual-hosted git repository.

beto pushed a commit to branch lyftga
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/lyftga by this push:
     new 9856800  Do not add tag to non-saved objects (#7266)
9856800 is described below

commit 9856800cee8b5b08d1a4aa85e8b45698805bd4e4
Author: Beto Dealmeida <roberto@dealmeida.net>
AuthorDate: Tue Apr 9 20:51:42 2019 -0700

    Do not add tag to non-saved objects (#7266)
---
 superset/views/tags.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/superset/views/tags.py b/superset/views/tags.py
index 3be8769..cffec87 100644
--- a/superset/views/tags.py
+++ b/superset/views/tags.py
@@ -77,6 +77,9 @@ class TagView(BaseSupersetView):
     @expose('/tags/<object_type:object_type>/<int:object_id>/', methods=['GET'])
     def get(self, object_type, object_id):
         """List all tags a given object has."""
+        if object_id == 0:
+            return json_success(json.dumps([]))
+
         query = db.session.query(TaggedObject).filter(and_(
             TaggedObject.object_type == object_type,
             TaggedObject.object_id == object_id))
@@ -87,6 +90,9 @@ class TagView(BaseSupersetView):
     @expose('/tags/<object_type:object_type>/<int:object_id>/', methods=['POST'])
     def post(self, object_type, object_id):
         """Add new tags to an object."""
+        if object_id == 0:
+            return Response(status=404)
+
         tagged_objects = []
         for name in request.get_json(force=True):
             if ':' in name:


Mime
View raw message