Back to index

plone3  3.1.7
adding.py
Go to the documentation of this file.
00001 from Products.Five.browser.adding import ContentAdding
00002 from Products.CMFCore.utils import getToolByName
00003 
00004 class CMFAdding(ContentAdding):
00005     """An adding view with a less silly next-url
00006     """
00007     
00008     # We need to do this to get proper traversal URLs - otherwise, the
00009     # <base /> tag is messed up.
00010     id = '+'
00011     
00012     def add(self, content):
00013         content = super(CMFAdding, self).add(content)
00014         
00015         # We need to ensure that we finish type construction, not at least
00016         # to set the correct permissions based on the workflow
00017         portal_types = getToolByName(content, 'portal_types')
00018         fti = portal_types.getTypeInfo(content)
00019         if fti is not None:
00020             fti._finishConstruction(content)
00021         
00022         return content
00023     
00024     def nextURL(self):
00025         return "%s/%s/view" % (self.context.absolute_url(), self.contentName)