mirror of
https://github.com/wagtail/wagtail.git
synced 2024-11-30 01:46:24 +01:00
Merge branch 'refactor/blank-except' of https://github.com/takeflight/wagtail into takeflight-refactor/blank-except
Conflicts: wagtail/wagtailimages/rich_text.py
This commit is contained in:
commit
1dafd8d7eb
@ -35,10 +35,8 @@ class ImageEmbedHandler(object):
|
||||
return "<img>"
|
||||
|
||||
image_format = get_image_format(attrs['format'])
|
||||
|
||||
if for_editor:
|
||||
try:
|
||||
return image_format.image_to_editor_html(image, attrs['alt'])
|
||||
except:
|
||||
return ''
|
||||
return image_format.image_to_editor_html(image, attrs['alt'])
|
||||
else:
|
||||
return image_format.image_to_html(image, attrs['alt'])
|
||||
|
@ -47,13 +47,3 @@ class TestImageEmbedHandler(TestCase):
|
||||
True
|
||||
)
|
||||
self.assertIn('<img data-embedtype="image" data-id="1" data-format="left" data-alt="test-alt" class="richtext-image left"', result)
|
||||
|
||||
@patch('wagtail.wagtailimages.models.Image')
|
||||
@patch('django.core.files.File')
|
||||
def test_expand_db_attributes_for_editor_throws_exception(self, mock_file, mock_image):
|
||||
result = ImageEmbedHandler.expand_db_attributes(
|
||||
{'id': 1,
|
||||
'format': 'left'},
|
||||
True
|
||||
)
|
||||
self.assertEqual(result, '')
|
||||
|
Loading…
Reference in New Issue
Block a user