Commit 9e3f2c48 authored by Vincent Pelletier's avatar Vincent Pelletier

erp5_discussion: Get a clean original_container acquisition chain

Otherwise, aq_chain looks like (note the Temporary Discussion Thread):
[
 <Discussion Post at /erp5/discussion_thread_module/1/2>,
 <Discussion Thread at /erp5/discussion_thread_module/1>,
 <Discussion Thread Module at /erp5/discussion_thread_module used for /erp5/web_site_module/km_test_web_site/forum/Thread-1-GAJgJcpBPJ>,
 <Temporary Discussion Thread at /erp5/web_site_module/km_test_web_site/forum/Thread-1-GAJgJcpBPJ>,
 <Web Section at /erp5/web_site_module/km_test_web_site/forum>,
 <Web Site at /erp5/web_site_module/km_test_web_site>,
 <Web Site Module at /erp5/web_site_module>,
 <ERP5Site at /erp5>,
 <Application at >,
 <ZPublisher.BaseRequest.RequestContainer object at 0x7f478aa18450>
]
which can confuse a "parent" walk.
Also, reuse existing code, related to asContext which is just what is
needed here.
parent dc2565f0
......@@ -12,7 +12,7 @@ is_temp_object = discussion_thread.isTempObject()
if is_temp_object:
# this is a temporary object accessed by its reference
# we need to get real ZODB one
discussion_thread = getattr(discussion_thread.original_container, discussion_thread.original_id)
discussion_thread = discussion_thread.getOriginalDocument()
discussion_post = discussion_thread.newContent(
portal_type = "Discussion Post",
......
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