You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@superset.apache.org by GitBox <gi...@apache.org> on 2018/04/23 15:27:51 UTC

[GitHub] mistercrunch closed pull request #3033: remove `utils.markdown()` / `Markup()` in description_columns

mistercrunch closed pull request #3033: remove `utils.markdown()` / `Markup()` in description_columns
URL: https://github.com/apache/incubator-superset/pull/3033
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/superset/connectors/druid/views.py b/superset/connectors/druid/views.py
index e12321755b..0a9297ddc5 100644
--- a/superset/connectors/druid/views.py
+++ b/superset/connectors/druid/views.py
@@ -48,14 +48,13 @@ class DruidColumnInlineView(CompactCRUDMixin, SupersetModelView):  # noqa
         'filterable': _(
             "Whether this column is exposed in the `Filters` section "
             "of the explore view."),
-        'dimension_spec_json': utils.markdown(
-            "this field can be used to specify  "
-            "a `dimensionSpec` as documented [here]"
+        'dimension_spec_json': _(
+            "This field can be used to specify  "
+            "a `dimensionSpec` as documented "
             "(http://druid.io/docs/latest/querying/dimensionspecs.html). "
             "Make sure to input valid JSON and that the "
             "`outputName` matches the `column_name` defined "
-            "above.",
-            True),
+            "above."),
     }
 
     def post_update(self, col):
@@ -80,11 +79,10 @@ class DruidMetricInlineView(CompactCRUDMixin, SupersetModelView):  # noqa
         'json': [validate_json],
     }
     description_columns = {
-        'metric_type': utils.markdown(
+        'metric_type': _(
             "use `postagg` as the metric type if you are defining a "
             "[Druid Post Aggregation]"
-            "(http://druid.io/docs/latest/querying/post-aggregations.html)",
-            True),
+            "(http://druid.io/docs/latest/querying/post-aggregations.html)"),
         'is_restricted': _("Whether the access to this metric is restricted "
                            "to certain roles. Only roles with the permission "
                            "'metric access on XXX (the name of this metric)' "
@@ -179,9 +177,9 @@ class DruidDatasourceModelView(SupersetModelView, DeleteMixin):  # noqa
             "datasource. If you want to change the datasource for a slice, "
             "overwrite the slice from the 'explore view'"),
         'offset': _("Timezone offset (in hours) for this datasource"),
-        'description': Markup(
-            "Supports <a href='"
-            "https://daringfireball.net/projects/markdown/'>markdown</a>"),
+        'description': _(
+            "Supports Markdown "
+            "(https://daringfireball.net/projects/markdown/>"),
         'fetch_values_from': _(
             "Time expression to use as a predicate when retrieving "
             "distinct values to populate the filter component. "
diff --git a/superset/connectors/sqla/views.py b/superset/connectors/sqla/views.py
index 5ba10dac54..dc65f676d0 100644
--- a/superset/connectors/sqla/views.py
+++ b/superset/connectors/sqla/views.py
@@ -48,27 +48,25 @@ class TableColumnInlineView(CompactCRUDMixin, SupersetModelView):  # noqa
             "It may be necessary to input a type manually for "
             "expression-defined columns in some cases. In most case "
             "users should not need to alter this."),
-        'expression': utils.markdown(
+        'expression': _(
             "a valid SQL expression as supported by the underlying backend. "
-            "Example: `substr(name, 1, 1)`", True),
-        'python_date_format': utils.markdown(Markup(
-            "The pattern of timestamp format, use "
-            "<a href='https://docs.python.org/2/library/"
-            "datetime.html#strftime-strptime-behavior'>"
-            "python datetime string pattern</a> "
-            "expression. If time is stored in epoch "
-            "format, put `epoch_s` or `epoch_ms`. Leave `Database Expression` "
-            "below empty if timestamp is stored in "
-            "String or Integer(epoch) type"), True),
-        'database_expression': utils.markdown(
+            "Example: `substr(name, 1, 1)`"),
+        'python_date_format': _(
+            "The pattern of timestamp format, use python datetime string "
+            "pattern expression, referring from https://docs.python.org/2/"
+            "library/datetime.html#strftime-strptime-behavior. "
+            "If time is stored in epoch format, put `epoch_s` or `epoch_ms`. "
+            "Leave `Database Expression` below empty if timestamp is stored "
+            "in String or Integer(epoch) type"),
+        'database_expression': _(
             "The database expression to cast internal datetime "
             "constants to database date/timestamp type according to the DBAPI. "
             "The expression should follow the pattern of "
             "%Y-%m-%d %H:%M:%S, based on different DBAPI. "
             "The string should be a python string formatter \n"
-            "`Ex: TO_DATE('{}', 'YYYY-MM-DD HH24:MI:SS')` for Oracle"
+            "`Ex: TO_DATE('{}', 'YYYY-MM-DD HH24:MI:SS')` for Oracle. "
             "Superset uses default expression based on DB URI if this "
-            "field is blank.", True),
+            "field is blank."),
     }
     label_columns = {
         'column_name': _("Column"),
@@ -96,20 +94,19 @@ class SqlMetricInlineView(CompactCRUDMixin, SupersetModelView):  # noqa
         'metric_name', 'description', 'verbose_name', 'metric_type',
         'expression', 'table', 'd3format', 'is_restricted']
     description_columns = {
-        'expression': utils.markdown(
+        'expression': _(
             "a valid SQL expression as supported by the underlying backend. "
-            "Example: `count(DISTINCT userid)`", True),
+            "Example: `count(DISTINCT userid)`"),
         'is_restricted': _("Whether the access to this metric is restricted "
                            "to certain roles. Only roles with the permission "
                            "'metric access on XXX (the name of this metric)' "
                            "are allowed to access this metric"),
-        'd3format': utils.markdown(
-            "d3 formatting string as defined [here]"
+        'd3format': _(
+            "d3 formatting string as defined"
             "(https://github.com/d3/d3-format/blob/master/README.md#format). "
             "For instance, this default formatting applies in the Table "
             "visualization and allow for different metric to use different "
-            "formats", True
-        ),
+            "formats"),
     }
     add_columns = edit_columns
     page_size = 500
@@ -167,9 +164,9 @@ class TableModelView(SupersetModelView, DeleteMixin):  # noqa
         'schema': _(
             "Schema, as used only in some databases like Postgres, Redshift "
             "and DB2"),
-        'description': Markup(
-            "Supports <a href='https://daringfireball.net/projects/markdown/'>"
-            "markdown</a>"),
+        'description': _(
+            "Supports Markdown (https://daringfireball.net/projects/markdown/"
+            "markdown)"),
         'sql': _(
             "This fields acts a Superset view, meaning that Superset will "
             "run a query against this string as a subquery."
diff --git a/superset/views/core.py b/superset/views/core.py
index 8a5de069ef..32082210b5 100755
--- a/superset/views/core.py
+++ b/superset/views/core.py
@@ -197,12 +197,12 @@ class DatabaseView(SupersetModelView, DeleteMixin):  # noqa
     edit_template = "superset/models/database/edit.html"
     base_order = ('changed_on', 'desc')
     description_columns = {
-        'sqlalchemy_uri': utils.markdown(
+        'sqlalchemy_uri': _(
             "Refer to the "
             "[SqlAlchemy docs]"
             "(http://docs.sqlalchemy.org/en/rel_1_0/core/engines.html#"
             "database-urls) "
-            "for more information on how to structure your URI.", True),
+            "for more information on how to structure your URI."),
         'expose_in_sqllab': _("Expose this DB in SQL Lab"),
         'allow_run_sync': _(
             "Allow users to run synchronous queries, this is the default "
@@ -220,7 +220,7 @@ class DatabaseView(SupersetModelView, DeleteMixin):  # noqa
         'force_ctas_schema': _(
             "When allowing CREATE TABLE AS option in SQL Lab, "
             "this option forces the table to be created in this schema"),
-        'extra': utils.markdown(
+        'extra': _(
             "JSON string containing extra configuration elements. "
             "The ``engine_params`` object gets unpacked into the "
             "[sqlalchemy.create_engine]"
@@ -228,7 +228,7 @@ class DatabaseView(SupersetModelView, DeleteMixin):  # noqa
             "sqlalchemy.create_engine) call, while the ``metadata_params`` "
             "gets unpacked into the [sqlalchemy.MetaData]"
             "(http://docs.sqlalchemy.org/en/rel_1_0/core/metadata.html"
-            "#sqlalchemy.schema.MetaData) call. ", True),
+            "#sqlalchemy.schema.MetaData) call. "),
     }
     label_columns = {
         'expose_in_sqllab': _("Expose in SQL Lab"),
@@ -333,11 +333,10 @@ class SliceModelView(SupersetModelView, DeleteMixin):  # noqa
         'params', 'cache_timeout']
     base_order = ('changed_on', 'desc')
     description_columns = {
-        'description': Markup(
+        'description': _(
             "The content here can be displayed as widget headers in the "
-            "dashboard view. Supports "
-            "<a href='https://daringfireball.net/projects/markdown/'>"
-            "markdown</a>"),
+            "dashboard view. Supports Markdown"
+            "(https://daringfireball.net/projects/markdown/markdown)"),
         'params': _(
             "These parameters are generated dynamically when clicking "
             "the save or overwrite button in the explore view. This JSON "


 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services