ec9c3554c4bf07d9400c9ccf1e5bfa7f6c09b08c
2 from Products
.CMFCore
.utils
import getToolByName
3 from Products
.Plinn
.utils
import makeValidId
4 from Products
.Plinn
.utils
import translate
5 _
= lambda msg
: translate(msg
, context
)
6 mtool
= getToolByName(context
, 'portal_membership')
7 homedir
= mtool
.getHomeFolder()
9 form
= context
.REQUEST
.form
.copy()
10 for k
, v
in form
.items() :
11 if hasattr(v
, 'has_key') :
14 title
= form
.pop('topic_title')
15 topic_id
= makeValidId(homedir
, title
)
16 id = homedir
.invokeFactory('Topic', topic_id
, title
=title
)
17 topic
= getattr(homedir
, id)
18 topic
.loadSearchQuery(form
)
20 context
.setStatus(True, _('Topic added.'))
22 ajax
= form
.pop('ajax')
25 return context
.setRedirect(topic
, 'object/view', ajax
=ajax
, syncFragments
= ['Breadcrumbs', 'rightCell'])