fix the anonymous view for the comments viewlet.

refactor get_replies.

svn path=/plone.app.discussion/trunk/; revision=27410
This commit is contained in:
Timo Stollenwerk 2009-06-13 18:02:59 +00:00
parent c318ecc6c5
commit 5300e33457
2 changed files with 20 additions and 16 deletions

View File

@ -102,7 +102,7 @@
action="" action=""
method="get" method="get"
style="display: inline;" style="display: inline;"
tal:repeat="action reply_dict/actions" tal:repeat="action reply_dict/actions|nothing"
tal:attributes="action string:${reply/absolute_url}/content_status_modify; tal:attributes="action string:${reply/absolute_url}/content_status_modify;
name action/id"> name action/id">
<input type="hidden" name="workflow_action" tal:attributes="value action/id" /> <input type="hidden" name="workflow_action" tal:attributes="value action/id" />

View File

@ -67,9 +67,7 @@ class CommentsViewlet(ViewletBase):
conversation = IConversation(context) conversation = IConversation(context)
conversation = IConversation(context).__of__(context) conversation = IConversation(context).__of__(context)
# Return all direct replies def replies_with_workflow_actions():
if conversation.total_comments > 0:
if workflow_actions:
# Return dict with workflow actions # Return dict with workflow actions
#context = aq_inner(self.context) #context = aq_inner(self.context)
wf = getToolByName(context, 'portal_workflow') wf = getToolByName(context, 'portal_workflow')
@ -82,10 +80,16 @@ class CommentsViewlet(ViewletBase):
r = r.copy() r = r.copy()
r['actions'] = actions r['actions'] = actions
yield r yield r
# Return all direct replies
if conversation.total_comments > 0:
if workflow_actions:
return replies_with_workflow_actions()
else: else:
yield conversation.getThreads() return conversation.getThreads()
else: else:
yield [] return None
def get_commenter_home_url(self, username): def get_commenter_home_url(self, username):
if username is None: if username is None: