0001-utils-do-not-raise-on-Django-syntax-error-in-templat.patch
combo/data/models.py | ||
---|---|---|
807 | 807 |
def sub_variadic_url(match): |
808 | 808 |
attribute = match.group(1) |
809 | 809 |
url = match.group(2) |
810 |
url = utils.get_templated_url(url, context=context) |
|
810 |
try: |
|
811 |
url = utils.get_templated_url(url, context=context) |
|
812 |
except utils.TemplateError as e: |
|
813 |
logger = logging.getLogger(__name__) |
|
814 |
logger.warning('error in templated URL (%s): %s' % (url, e)) |
|
811 | 815 |
return '%s="%s"' % (attribute, url) |
812 | 816 |
text = re.sub(r'(href|src)="(.*?)"', sub_variadic_url, text) |
813 | 817 |
tests/test_pages.py | ||
---|---|---|
365 | 365 |
response = app.get(page.get_online_url()) |
366 | 366 |
assert '<meta name="description" content="page description" />' in response.text |
367 | 367 |
assert '<title>Combo - foo</title>' in response.text |
368 | ||
369 |
def test_render_cell_having_href_template_error(app): |
|
370 |
page = Page(title=u'foo', slug='foo', template_name='standard-sidebar', order=0, description="page description") |
|
371 |
page.save() |
|
372 |
cell = TextCell(page=page, |
|
373 |
text='<a href="{{e-service_url}}backoffice/...">link</a>', |
|
374 |
order=0, placeholder='content') |
|
375 |
cell.save() |
|
376 |
response = app.get(page.get_online_url()) |
|
377 |
assert "{{e-service_url}}backoffice/..." in response.text # href not rendered |
|
368 |
- |