Bugfix.
[Plinn.git] / skins / generic / discussion_reply_form.py
1 ##parameters=
2 form = context.REQUEST.form
3 form_has = form.has_key
4
5 if context.meta_type == 'Discussion Item' :
6 contentOb = context.parentsInThread()[0]
7 else :
8 contentOb = context
9
10 if form_has('cancel_reply') :
11 contentOb.setRedirect(contentOb, 'object/view', **form)
12 return
13 elif form_has('add_reply') :
14 replyId = context.reply_add_control(**form)
15 if replyId :
16 context.setRedirect(contentOb, 'object/view', new_reply_id=replyId, **form)
17 return
18
19 options = {'reply_for_ob' : context, 'ajax' : form_has('ajax') and '1' or None, 'inReplyTo' : context}
20 return getattr(contentOb, contentOb.getActionInfo('object/view')['url'].split('/')[-1])(**options)