-
-
Notifications
You must be signed in to change notification settings - Fork 56
Open
Labels
Description
The following code fails on Dexterity-based content types (plone.app.contenttypes):
with api.env.adopt_roles(['Manager']):
obj = api.content.create(
container=portal,
type='Document',
title=u'Pangram',
text=u'<p>The quick brown fox jumps over the lazy dog</p>',
)
on Archetypes, the text field is set; on Dexterity, the text field is set as a unicode object leading to the following error:
AttributeError: 'unicode' object has no attribute 'output_relative_to'
the workaround is something like:
def set_text_field(obj, text):
try:
obj.setText(text) # Archetypes
except AttributeError:
obj.text = RichTextValue(text, 'text/html', 'text/html') # Dexterity
where do we handle this? here or in plone.app.contenttypes?