source: products/qPloneComments/branches/plone3_extend/skins/qplonecomments/validate_reply.vpy @ 858

Last change on this file since 858 was 806, checked in by crchemist, 17 years ago

Add role 'Editor' to portal.

  • Property svn:eol-style set to native
File size: 1.0 KB
Line 
1## Controller Script Python "validate_reply"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind state=state 
7##bind subpath=traverse_subpath
8##parameters=
9##title=validates discussion_reply
10from Products.CMFPlone import MessageFactory
11_ = MessageFactory('plonecomments')
12
13if hasattr(context, 'review_state') and not context.review_state=="published":
14    #from Products.qPloneComments.utils import setStatusMsg
15    msg = _(u'Reply not allowed because the response is to a comment waiting to be\
16 approved. Please wait for the comment to be approved before replying.')
17
18    state.set(status='failure', portal_status_message=msg)
19    return state.set(status='failure')
20
21    # Resolve needless redirection, which leed to loosing portal status message.
22    #try:
23        #redirect_target = context.plone_utils.getDiscussionThread(context)[0]
24    #except:
25        #redirect_target = context
26    #setStatusMsg(state, context, msg)
27    #return state.set(status='failure', context=redirect_target)
28
29return state
Note: See TracBrowser for help on using the repository browser.