betodealmeida commented on a change in pull request #5524: A tagging system for
dashboards, charts and queries
URL:
https://github.com/apache/incubator-superset/pull/5524#discussion_r206592813
##########
File path: superset/views/tags.py
##########
@@ -0,0 +1,198 @@
+# -*- coding: utf-8 -*-
+# pylint: disable=C,R,W
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+
+import simplejson as json
+
+from flask import Response, request
+from flask_appbuilder import expose
+from jinja2.sandbox import SandboxedEnvironment
+from sqlalchemy import and_, func
+from werkzeug.routing import BaseConverter
+
+from superset import app, appbuilder, db, utils
+from superset.jinja_context import current_user_id, current_username
+from superset.models.sql_lab import SavedQuery
+from superset.models.tags import Tag, TaggedObject, TagTypes, ObjectTypes
+import superset.models.core
+from .base import BaseSupersetView
+
+
+class ObjectTypeConverter(BaseConverter):
Review comment:
Just to be clear, this class is used for validating the path in the views
defined in this file. For example:
```python
@expose('/tags/<object_type:object_type>/<int:object_id>/', methods=['GET'])
def get(self, object_type, object_id):
...
```
Using the validator, `/tags/chart/1/` is a valid path (since `chart` is in
the `ObjectTypes` enum) but `/tags/foo/1` is invalid. Since the concept of
`object_type` is only used in tag views, I think moving this to `utils.py` will
not be very useful, since it's unlikely that it will be used in other places.
I'll add unit tests, good point.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]