2 from DateTime
import DateTime
3 from Products
.CMFCore
.utils
import getToolByName
5 eventId
= DateTime().strftime("%Y%m%d_%H%M%S")
6 newOb
= getattr(context
, context
.invokeFactory('Event', eventId
, title
=' '))
8 ttool
= getToolByName(context
, 'portal_types')
10 immediate_view
= ti
.immediate_view
12 immediate_view
= ti
.immediate_view
13 if immediate_view
.find('/') > 0 :
14 newOb
.setStatus('True', 'Object created.')
15 return newOb
.setRedirect(newOb
, immediate_view
, ajax
=ajax
)
17 from ZTUtils
import make_query
18 ob_url
= newOb
.absolute_url()
19 query
= make_query(portal_status_message
= 'Object created.', ajax
= ajax
)
20 url
= "%s/%s?%s" % (ob_url
, immediate_view
, query
)
21 return response
.redirect(url
)