publik: fix get filter called on LazyCardDef (#88578)
gitea/publik-django-templatetags/pipeline/head This commit looks good
Details
gitea/publik-django-templatetags/pipeline/head This commit looks good
Details
This commit is contained in:
parent
6ad1cc0911
commit
e68e6e7ff9
|
@ -40,6 +40,8 @@ def get(obj, key):
|
|||
return obj[key]
|
||||
except (IndexError, KeyError, TypeError):
|
||||
return None
|
||||
except TypeError:
|
||||
return None
|
||||
|
||||
|
||||
@register.filter
|
||||
|
|
|
@ -112,6 +112,11 @@ def test_objects(mock_send, settings, context, nocache):
|
|||
t.render(context)
|
||||
assert mock_send.call_args_list[0][0][0].url.startswith('http://127.0.0.3:8999/api/cards/bar/list?')
|
||||
|
||||
mock_send.reset_mock()
|
||||
t = Template('{{ cards|get:"bar" }}')
|
||||
t.render(context)
|
||||
assert mock_send.call_args_list == []
|
||||
|
||||
context = Context({}) # no cards in context
|
||||
mock_send.reset_mock()
|
||||
t = Template('{{ cards|objects:"bar" }}')
|
||||
|
|
Loading…
Reference in New Issue