Creating a Document dexterity item issues


I have been able to create Documents with api.content.create as follows:

api.content.create(type='Document',container=file_new_obj_dir,title=title,safe_id=False,text = RichTextValue(text,obj_format,"text/x-html-safe"))

This puts all the 'text' into the of the page, however, the body class is much shorter and less than those that are created via the plone interface. Thus the pages do not look right (style-wise). Is this a known issue or should I take another step that I have omitted?


Your writing makes no sense without screenshot.


text = RichTextValue(
        	'<p>Here is the text</p>',

Should produce 'the same' as that created via Phone interface.

My guess is that you definition of 'text' is wrong (is it html?)

I guess my question was a bit vague. Here is another way of putting it...

From my understanding 'create' puts all the 'text' into the of a page that it creates.
How or why does the body tag differ from a page that was created in the plone interface. Here are the two side by side:

Here is the one that is programmatically created with api.content.create:

And here is what is the body tag looks like when done in plone interface:

(sorry about pastebin... the text was too long and wasn't showing here)

No, it does not put the text into the body part, … depending on content type, it puts it (in a div) in # content-core.

What you should check is the source in the the editor (after save) and compare them