mistercrunch commented on a change in pull request #11704:
URL: 
https://github.com/apache/incubator-superset/pull/11704#discussion_r523640435



##########
File path: superset/jinja_context.py
##########
@@ -229,22 +277,28 @@ def __init__(
             "filter_values": filter_values,
             "form_data": {},
         }
+
         self._context.update(kwargs)
         self._context.update(jinja_base_context)
+
         if self.engine:
             self._context[self.engine] = self
-        self._env = SandboxedEnvironment()
 
-    def process_template(self, sql: str, **kwargs: Any) -> str:
-        """Processes a sql template
 
-        >>> sql = "SELECT '{{ datetime(2017, 1, 1).isoformat() }}'"
-        >>> process_template(sql)
-        "SELECT '2017-01-01T00:00:00'"
-        """
-        template = self._env.from_string(sql)
-        kwargs.update(self._context)
-        return template.render(kwargs)
+class SafeJinjaTemplateProcessor(BaseTemplateProcessor):
+    def set_context(self, **kwargs: Any) -> None:
+        extra_cache = ExtraCache(self._extra_cache_keys)
+        self._context = {
+            "url_param": partial(safe_proxy, extra_cache.url_param),

Review comment:
       Wasn't familiar with `partial`, but I'm guessing that the intent is to 
clean up other methods/context that could be attached to the callable (?)




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to