Commit 51f47079 authored by Boxiang Sun's avatar Boxiang Sun

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

Please see 2b374847
parent 2b374847
...@@ -3,20 +3,19 @@ portal = context.getPortalObject() ...@@ -3,20 +3,19 @@ portal = context.getPortalObject()
# create an HTML Post # create an HTML Post
post_module = portal.post_module 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() now = DateTime()
post_edit_kw = { post_edit_kw = {
"start_date": now, "start_date": now,
"follow_up_value": follow_up_object, "follow_up_value": follow_up_value,
"text_content": data, "text_content": data,
} }
if predecessor is not None: if predecessor is not None:
predecessor_value, = portal.portal_catalog(relative_url=predecessor, limit=2) predecessor_value, = portal.portal_catalog(relative_url=predecessor, limit=2)
post_edit_kw["predecessor_value"] = predecessor_value.getObject() post_edit_kw["predecessor_value"] = predecessor_value.getObject()
post = post_module.newContent( 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', portal_type='HTML Post',
**post_edit_kw **post_edit_kw
) )
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <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>
<item> <item>
<key> <string>_proxy_roles</string> </key> <key> <string>_proxy_roles</string> </key>
......
return context.PostModule_createHTMLPost( return context.PostModule_createHTMLPost(
follow_up=follow_up, follow_up_value=follow_up_value,
predecessor=predecessor, predecessor=predecessor,
data="<p>" + data.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;").replace(" ", " &nbsp;").replace("\n", "<br/>") + "</p>", data="<p>" + data.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;").replace(" ", " &nbsp;").replace("\n", "<br/>") + "</p>",
) )
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <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>
<item> <item>
<key> <string>_proxy_roles</string> </key> <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