Commit 8459031e authored by Boxiang Sun's avatar Boxiang Sun

erp5_post: Use object's value instead object's url

Please see 06e8f728
parent 44b829bb
......@@ -3,20 +3,19 @@ portal = context.getPortalObject()
# create an HTML Post
post_module = portal.post_module
# get the related object
follow_up_object, = portal.portal_catalog(relative_url=follow_up, limit=2)
follow_up_object = follow_up_object.getObject()
now = DateTime()
post_edit_kw = {
"start_date": now,
"follow_up_value": follow_up_object,
"follow_up_value": follow_up_value,
"text_content": data,
}
if predecessor is not None:
predecessor_value, = portal.portal_catalog(relative_url=predecessor, limit=2)
post_edit_kw["predecessor_value"] = predecessor_value.getObject()
post = post_module.newContent(
reindex_on_commit=True,
# XXX in support request web app interface, discussable page reloads right after
# adding a post, searching for new post hoping it is already indexed.
portal_type='HTML Post',
**post_edit_kw
)
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>follow_up, data, predecessor=None</string> </value>
<value> <string>follow_up_value, data, predecessor=None</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
......
return context.PostModule_createHTMLPost(
follow_up=follow_up,
follow_up_value=follow_up_value,
predecessor=predecessor,
data="<p>" + data.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;").replace(" ", " &nbsp;").replace("\n", "<br/>") + "</p>",
)
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>follow_up, data, predecessor=None</string> </value>
<value> <string>follow_up_value, data, predecessor=None</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment