From 5387256b938384f4b932d811ed0df78f41095038 Mon Sep 17 00:00:00 2001 From: relikd Date: Sat, 6 Aug 2022 17:45:38 +0200 Subject: [PATCH] fix: split_strip() arg must be str --- lektor_groupby/config.py | 4 +++- lektor_groupby/util.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lektor_groupby/config.py b/lektor_groupby/config.py index 37caa12..9ba1817 100644 --- a/lektor_groupby/config.py +++ b/lektor_groupby/config.py @@ -52,13 +52,15 @@ class Config: def set_order_by(self, order_by: Optional[str]) -> None: ''' If specified, children will be sorted according to keys. ''' - self.order_by = split_strip(order_by, ',') or None + self.order_by = split_strip(order_by or '', ',') or None def __repr__(self) -> str: txt = '' @staticmethod diff --git a/lektor_groupby/util.py b/lektor_groupby/util.py index ecb76a3..2689ea7 100644 --- a/lektor_groupby/util.py +++ b/lektor_groupby/util.py @@ -32,7 +32,7 @@ def most_used_key(keys: List[str]) -> str: def split_strip(data: str, delimiter: str = ',') -> List[str]: ''' Split by delimiter and strip each str separately. Omit if empty. ''' ret = [] - for x in (data or '').split(delimiter): + for x in data.split(delimiter): x = x.strip() if x: ret.append(x)