rusackas commented on code in PR #40863:
URL: https://github.com/apache/superset/pull/40863#discussion_r3375718579
##########
superset/viz.py:
##########
@@ -1664,7 +1673,15 @@ def get_data(self, df: pd.DataFrame) -> VizData:
from superset import db
from superset.models.slice import Slice
- slice_ids = self.form_data.get("deck_slices")
+ slice_ids = self.form_data.get("deck_slices") or []
+ max_deck_slices = current_app.config["VIZ_DECK_SLICES_MAX_LIST_SIZE"]
+ if max_deck_slices and len(slice_ids) > max_deck_slices:
Review Comment:
Good catch on the non-list case — added an `isinstance(slice_ids, list)`
guard that coerces any non-list value to an empty list before we apply the size
limit and `Slice.id.in_(...)`, so a stray string can no longer iterate
characters or distort the count.
On `config.get(..., 0)`: `VIZ_DECK_SLICES_MAX_LIST_SIZE` ships with a
default in `superset/config.py` (set to 10), so it is always present, and
direct `config["..."]` access is the established convention throughout
`viz.py`. Keeping that consistent here.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]