0001-search-ignore-links-depending-on-cards-forms-request.patch
combo/data/models.py | ||
---|---|---|
1784 | 1784 |
def get_external_links_data(self): |
1785 | 1785 |
if not self.url: |
1786 | 1786 |
return [] |
1787 |
if re.search(r'{{.*(request\.|cards\||forms\|)', self.url): |
|
1788 |
# skip URL templates that would reference request or the cards or forms |
|
1789 |
# context processor variables. |
|
1790 |
return [] |
|
1787 | 1791 |
link_data = self.get_cell_extra_context({}) |
1788 | 1792 |
if link_data.get('title') and link_data.get('url'): |
1789 | 1793 |
return [link_data] |
tests/test_search.py | ||
---|---|---|
592 | 592 |
url='http://example.org/', |
593 | 593 |
order=1, |
594 | 594 |
) |
595 |
with mock.patch('combo.data.models.LinkCell.check_validity'): # validity check would fail, skip it. |
|
596 |
LinkCell.objects.create( |
|
597 |
page=page, |
|
598 |
placeholder=cell.link_placeholder, |
|
599 |
title='Example 3 Site', |
|
600 |
url='http://example.org/{{ cards|objects:"foo"|filter_by_user:request.user|first|get:"id" }}', |
|
601 |
order=1, |
|
602 |
) |
|
595 | 603 | |
596 | 604 |
index_site() |
597 | 605 | |
598 |
- |