You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/02/15 08:47:24 UTC

[GitHub] [superset] ktmud commented on pull request #11776: fix(reports): dashboard references aren't clear

ktmud commented on pull request #11776:
URL: https://github.com/apache/superset/pull/11776#issuecomment-779061759


   @mistercrunch I'm sorry but this change may actually be safe since although `flask-caching` uses [string formatting](https://github.com/sh4nks/flask-caching/blob/e81c0b9c11ab66e3ab05538f36417a64f2b37a25/flask_caching/__init__.py#L657) to construct cache keys:
   
   ```python
               if callable(f):
                   keyargs, keykwargs = self._memoize_kwargs_to_args(
                       f, *args, **kwargs
                   )
               else:
                   keyargs, keykwargs = args, kwargs
   
               updated = u"{0}{1}{2}".format(altfname, keyargs, keykwargs)
   ```
   
   But since the `args` here is a tuple, it will be converted to a string via the calling tuple's  `__str__`, which will then call `__repr__` for each element in the tuple.
   
   Either way, I'd still recommend adding dashboard IDs to `__str__` just to make sure it's possible to differentiate dashboards with the same title.
   
   ```python 
       def __str__(self) -> str:
           return f"{self.dashboard_title} (ID: {self.id})"
   ```


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



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org