Пример #1
0
def replaceUserFolder(portal, out):
    print >> out, ("\nUser folder replacement from CMFMember to " "remember:")

    print >> out, " - Creating temporary folder"
    portal.invokeFactory('Folder', 'cmfmember_tmp')

    print >> out, (" - Moving existing user folder into temporary " "folder")

    unrestricted_move(portal.cmfmember_tmp, portal.acl_users)
    addPAS(portal, out)

    print >> out, "...replace done"
Пример #2
0
def replaceUserFolder(portal, out):
    print >> out, ("\nUser folder replacement from CMFMember to "
                   "remember:")

    print >> out, " - Creating temporary folder"
    portal.invokeFactory('Folder', 'cmfmember_tmp')

    print >> out, (" - Moving existing user folder into temporary "
                   "folder")

    unrestricted_move(portal.cmfmember_tmp, portal.acl_users)
    addPAS(portal, out)

    print >> out, "...replace done"
Пример #3
0
def migrateMemberDataTool(portal, out):
    print >> out, ("MemberData Tool (portal_memberdata) from "
                   "CMFMember to remember")

    print >> out, " ...move MemberData Tool to temporary folder"
    unrestricted_move(portal.cmfmember_tmp, portal.portal_memberdata)

    ps_out = []
    installPortalSetup(portal, ps_out)
    print >> out, '\n'.join(ps_out)

    # Need CMFMember Member Type Info out of the way for GenericSetup
    # steps
    pt = getToolByName(portal, 'portal_types')
    wft = getToolByName(portal, 'portal_workflow')

    mig_map_values = MIGRATION_MAP.values()

    print >> out, " ...moving old member types and workflows out of the way"
    for info in mig_map_values:
        mem_type = info['atct_newTypeFor']['portal_type']
        chain = wft.getChainForPortalType(mem_type)
        info['chain'] = chain
        unrestricted_move(portal.cmfmember_tmp,
                          getattr(pt, mem_type))
        if info.get('replace_workflows', False):
            wf_ids = info['workflow_ids']
            for wf_id in wf_ids:
                wft._delObject(wf_id)

    ps = getToolByName(portal, 'portal_setup')
    qi = getToolByName(portal, 'portal_quickinstaller')

    print >> out, " ...applying membrane profile"
    ps.setImportContext('profile-CMFPlone:plone')
    ps.setImportContext('profile-membrane:default')
    ps.runAllImportSteps()

    print >> out, " ...applying new member implementation profiles"
    for info in mig_map_values:
        profile = info.get('profile', None)
        product = info.get('product', None)
        if profile is not None:
            ps.setImportContext(profile)
            ps.runAllImportSteps()
        elif product is not None:
            # use a QI install method instead
            if not qi.isProductInstalled(product):
                qi.installProduct(product)
            else:
                qi.reinstallProducts([product])

    print >> out, " ...restoring old member types"
    # Needed for the actual member migration
    for info in mig_map_values:
        mem_type = info['atct_newTypeFor']['portal_type']
        unrestricted_move(pt, getattr(portal.cmfmember_tmp, mem_type))
        wft.setChainForPortalTypes((mem_type,), info['chain'])

    if hasattr(aq_base(portal.cmfmember_tmp.portal_memberdata),
               '_actions'):
        print >> out, " ...migrating actions"
        actions = portal.cmfmember_tmp.portal_memberdata._actions
        portal.portal_memberdata._actions = actions

    print >> out, " ...migrating data"
    mdtool = portal.cmfmember_tmp.portal_memberdata
    properties = mdtool._properties
    for elt in properties:
        elt['value'] = mdtool.getProperty(elt['id'])
        updateProp(portal.portal_memberdata, elt)

    print >> out, " ...done"
Пример #4
0
def migrateMemberDataTool(portal, out):
    print >> out, ("MemberData Tool (portal_memberdata) from "
                   "CMFMember to remember")

    print >> out, " ...move MemberData Tool to temporary folder"
    unrestricted_move(portal.cmfmember_tmp, portal.portal_memberdata)

    ps_out = []
    installPortalSetup(portal, ps_out)
    print >> out, '\n'.join(ps_out)

    # Need CMFMember Member Type Info out of the way for GenericSetup
    # steps
    pt = getToolByName(portal, 'portal_types')
    wft = getToolByName(portal, 'portal_workflow')

    mig_map_values = MIGRATION_MAP.values()

    print >> out, " ...moving old member types and workflows out of the way"
    for info in mig_map_values:
        mem_type = info['atct_newTypeFor']['portal_type']
        chain = wft.getChainForPortalType(mem_type)
        info['chain'] = chain
        unrestricted_move(portal.cmfmember_tmp, getattr(pt, mem_type))
        if info.get('replace_workflows', False):
            wf_ids = info['workflow_ids']
            for wf_id in wf_ids:
                wft._delObject(wf_id)

    ps = getToolByName(portal, 'portal_setup')
    qi = getToolByName(portal, 'portal_quickinstaller')

    # need to instantiate a default MemberDataTool since changes to
    # GenericSetup mean the membrane profile is no longer doing so,
    # but it will fail if there isn't one
    if portal._getOb('portal_memberdata', None) is None:
        mdtool = MemberDataTool()
        portal._setObject('portal_memberdata', mdtool)

    print >> out, " ...applying membrane profile"
    ps.setImportContext('profile-CMFPlone:plone')
    ps.setImportContext('profile-membrane:default')
    ps.runAllImportSteps()

    print >> out, " ...applying new member implementation profiles"
    for info in mig_map_values:
        profile = info.get('profile', None)
        product = info.get('product', None)
        if profile is not None:
            ps.setImportContext(profile)
            ps.runAllImportSteps()
        elif product is not None:
            # use a QI install method instead
            if not qi.isProductInstalled(product):
                qi.installProduct(product)
            else:
                qi.reinstallProducts([product])

    print >> out, " ...restoring old member types"
    # Needed for the actual member migration
    for info in mig_map_values:
        mem_type = info['atct_newTypeFor']['portal_type']
        unrestricted_move(pt, getattr(portal.cmfmember_tmp, mem_type))
        wft.setChainForPortalTypes((mem_type, ), info['chain'])

    if hasattr(aq_base(portal.cmfmember_tmp.portal_memberdata), '_actions'):
        print >> out, " ...migrating actions"
        actions = portal.cmfmember_tmp.portal_memberdata._actions
        portal.portal_memberdata._actions = actions

    print >> out, " ...migrating data"
    mdtool = portal.cmfmember_tmp.portal_memberdata
    properties = mdtool._properties
    for elt in properties:
        elt['value'] = mdtool.getProperty(elt['id'])
        updateProp(portal.portal_memberdata, elt)

    print >> out, " ...done"