CMFPlone/TypesTool.py:
security.declarePublic('constructContent')
def constructContent( self
, type_name
, container
, id
, RESPONSE=None
, *args
, **kw
):
"""
Build an instance of the appropriate content
class in
'container', using 'id'.
"""
info = self.getTypeInfo( type_name )
if info is None:
raise 'ValueError', 'No such content type: %s' %
type_name
# check we're allowed to access the type object
if not self._checkViewType(info):
raise Unauthorized,info
ob = apply(info.constructInstance, (container, id) +
args, kw)
if RESPONSE is not None:
immediate_url = '%s/%s' % ( ob.absolute_url()
, info.immediate_view )
RESPONSE.redirect( immediate_url )
# THIS IS THE IMPORTANT PART:
return ob.getId()
|