Back to index

plone3  3.1.7
Functions
wicked.atcontent.Extensions.migrate_atdoc_wickeddoc Namespace Reference

Functions

def migrate_atdoc_wickeddoc

Function Documentation

Definition at line 5 of file migrate_atdoc_wickeddoc.py.

00005 
00006 def migrate_atdoc_wickeddoc(self):
00007     catalog = getToolByName(self, 'portal_catalog')
00008     portal = getToolByName(self, 'portal_url').getPortalObject()
00009     out = []
00010 
00011     migrator = WickedDocMigrator
00012     out.append('*** Migrating %s to %s ***\n' % (migrator.src_portal_type,
00013                                                  migrator.dst_portal_type))
00014     try:
00015         w = CatalogWalker(migrator, portal) # ATCT-0.2
00016     except AttributeError:
00017         w = CatalogWalker(portal, migrator) # ATCT-1.0
00018     w_result = w.go()
00019     if type(w_result) == type(''):
00020         out.append(w_result) # ATCT-0.2
00021     else:
00022         out.append('%s Migrated\n' % migrator.src_portal_type)
00023 
00024     wf = getToolByName(self, 'portal_workflow')
00025     count = wf.updateRoleMappings()
00026     out.append('Workflow: %d object(s) updated.' % count)
00027 
00028     catalog.refreshCatalog(clear=1)
00029     out.append('Portal catalog updated.')
00030 
00031     ttool = getToolByName(self, 'portal_types')
00032     doc_fti = ttool.getTypeInfo('Document')
00033     if doc_fti.Metatype() != 'WickedDoc':
00034         atct_tool = getToolByName(self, 'portal_atct')
00035         get_transaction().commit(1)
00036         atct_tool._changePortalTypeName('Document', 'ATDocument',
00037                                         global_allow=0,
00038                                         title='AT Document')
00039         get_transaction().commit(1)
00040         atct_tool._changePortalTypeName('WickedDoc', 'Document',
00041                                         global_allow=1,
00042                                         title='Page')
00043         out.append('Document types switched')
00044 
00045     return '\n'.join(out)

Here is the call graph for this function: