source: products/qPloneComments/branches/plone-2.5/skins/qplonecomments/validate_reply.vpy @ 494

Last change on this file since 494 was 1, checked in by myroslav, 18 years ago

Building directory structure

File size: 977 bytes
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
10
11if hasattr(context, 'review_state') and not context.review_state=="published":
12    from Products.qPloneComments.utils import setStatusMsg
13    msg = "Reply not allowed because the response is to a comment waiting to be " \
14           "approved. Please wait for the comment to be approved before replying."
15
16    state.set(status='failure', portal_status_message=msg)
17    return state.set(status='failure')
18
19    # Resolve needless redirection, which leed to loosing portal status message.
20    #try:
21        #redirect_target = context.plone_utils.getDiscussionThread(context)[0]
22    #except:
23        #redirect_target = context
24    #setStatusMsg(state, context, msg)
25    #return state.set(status='failure', context=redirect_target)
26
27return state
Note: See TracBrowser for help on using the repository browser.