Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
78 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<tal:twitter condition="view/metadata_enabled"> | ||
<meta name="twitter:card" content="summary_large_image" /> | ||
<meta name="twitter:image" tal:attributes="content view/image_url" tal:condition="view/image_url" /> | ||
<meta name="twitter:site" tal:attributes="content string:@${view/via}" /> | ||
<meta name="twitter:title" tal:attributes="content view/title" /> | ||
<meta name="twitter:description" tal:attributes="content view/description" /> | ||
</tal:twitter> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# -*- coding: utf-8 -*- | ||
"""Hacks to work around API inconsistencies between Archetypes and Dexterity.""" | ||
|
||
|
||
def set_image_field(obj, image, content_type): | ||
"""Set image field in object on both, Archetypes and Dexterity.""" | ||
from plone.namedfile.file import NamedBlobImage | ||
try: | ||
obj.setImage(image) # Archetypes | ||
except AttributeError: | ||
# Dexterity | ||
data = image if type(image) == str else image.getvalue() | ||
obj.image = NamedBlobImage(data=data, contentType=content_type) | ||
finally: | ||
obj.reindexObject() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters