当前位置: 首页>>代码示例>>Python>>正文


Python CustomQueryWalker.go方法代码示例

本文整理汇总了Python中Products.contentmigration.walker.CustomQueryWalker.go方法的典型用法代码示例。如果您正苦于以下问题:Python CustomQueryWalker.go方法的具体用法?Python CustomQueryWalker.go怎么用?Python CustomQueryWalker.go使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Products.contentmigration.walker.CustomQueryWalker的用法示例。


在下文中一共展示了CustomQueryWalker.go方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: migrate

# 需要导入模块: from Products.contentmigration.walker import CustomQueryWalker [as 别名]
# 或者: from Products.contentmigration.walker.CustomQueryWalker import go [as 别名]
def migrate(context):
    # switch linkintegrity temp off
    ptool = queryUtility(IPropertiesTool)
    site_props = getattr(ptool, 'site_properties', None)
    linkintegrity = site_props.getProperty(
        'enable_link_integrity_checks',
        False
    )
    site_props.manage_changeProperties(enable_link_integrity_checks=False)

    # do migration
    portal = getToolByName(context, 'portal_url').getPortalObject()
    walker = CustomQueryWalker(
        portal, PloneArticleMigrator,
        query=dict(object_provides=IPloneArticle.__identifier__),
        callBefore=callBefore)
    savepoint(optimistic=True)
    walker.go()

    # switch linkintegrity back
    site_props.manage_changeProperties(
        enable_link_integrity_checks=linkintegrity
    )

    return walker.getOutput()
开发者ID:collective,项目名称:collective.folderishtypes,代码行数:27,代码来源:migrate_plonearticle.py

示例2: migrate_fileVirtualcollections_to_blob

# 需要导入模块: from Products.contentmigration.walker import CustomQueryWalker [as 别名]
# 或者: from Products.contentmigration.walker.CustomQueryWalker import go [as 别名]
 def migrate_fileVirtualcollections_to_blob(self):
     upgrades.log('Migrating FileVirtualcollections to blob')
     walker = CustomQueryWalker(
         self.context,
         FileVirtualcollectionsMigrator,
         full_transaction=True)
     walker.go()
     upgrades.commit(self.context)
开发者ID:RBINS,项目名称:virtualcollections,代码行数:10,代码来源:migrate.py

示例3: to_blob_f

# 需要导入模块: from Products.contentmigration.walker import CustomQueryWalker [as 别名]
# 或者: from Products.contentmigration.walker.CustomQueryWalker import go [as 别名]
 def to_blob_f(self):
     """To avoir conflicts during the plonemigration loop, run the blob migration now"""
     portal = getToolByName(self.context, 'portal_url').getPortalObject()
     migrator = FMigrator
     walker = CustomQueryWalker(portal, migrator, full_transaction=True)
     upgrades.log('Migrating files to blob')
     walker.go()
     upgrades.commit(self.context)
开发者ID:AntoineVe,项目名称:ibwt.plonesite,代码行数:10,代码来源:migrate.py

示例4: migrate_filePhenologyPlone_to_blob

# 需要导入模块: from Products.contentmigration.walker import CustomQueryWalker [as 别名]
# 或者: from Products.contentmigration.walker.CustomQueryWalker import go [as 别名]
 def migrate_filePhenologyPlone_to_blob(self):
     upgrades.log('Migrating FilePhenologyPlone to blob')
     walker = CustomQueryWalker(
         self.context,
         FilePhenologyPloneMigrator,
         full_transaction=True)
     walker.go()
     upgrades.commit(self.context)
开发者ID:makinacorpus,项目名称:phenology.plone,代码行数:10,代码来源:migrate.py

示例5: migrate_fileTestCgwb_to_blob

# 需要导入模块: from Products.contentmigration.walker import CustomQueryWalker [as 别名]
# 或者: from Products.contentmigration.walker.CustomQueryWalker import go [as 别名]
 def migrate_fileTestCgwb_to_blob(self):
     upgrades.log('Migrating FileTestCgwb to blob')
     walker = CustomQueryWalker(
         self.context,
         FileTestCgwbMigrator,
         full_transaction=True)
     walker.go()
     upgrades.commit(self.context)
开发者ID:makinacorpus,项目名称:cgwb-test,代码行数:10,代码来源:migrate.py

示例6: upgrade_step_1

# 需要导入模块: from Products.contentmigration.walker import CustomQueryWalker [as 别名]
# 或者: from Products.contentmigration.walker.CustomQueryWalker import go [as 别名]
def upgrade_step_1(context):
    portal = getToolByName(context, 'portal_url').getPortalObject()
    walker = CustomQueryWalker(
        portal, PAEATMigrator,
        query=dict(object_provides=IATEvent.__identifier__),
        callBefore=callBefore)
    savepoint(optimistic=True)
    walker.go()
    return walker.getOutput()
开发者ID:senner,项目名称:plone.app.event,代码行数:11,代码来源:event.py

示例7: execute

# 需要导入模块: from Products.contentmigration.walker import CustomQueryWalker [as 别名]
# 或者: from Products.contentmigration.walker.CustomQueryWalker import go [as 别名]
 def execute(self, query, actions, callBefore=None, **kwargs):
     TestMigrator.fieldActions = actions
     walker = CustomQueryWalker(self.portal, TestMigrator,
                                 query = query,
                                 callBefore = callBefore,
                                 **kwargs)
     # Need this to avoid copy errors....
     transaction.savepoint(optimistic=True)
     walker.go(**kwargs)
开发者ID:CGTIC,项目名称:Plone_SP,代码行数:11,代码来源:cmtc.py

示例8: migrate

# 需要导入模块: from Products.contentmigration.walker import CustomQueryWalker [as 别名]
# 或者: from Products.contentmigration.walker.CustomQueryWalker import go [as 别名]
def migrate(context, portal_type=None, meta_type=None, walker=None):
    """ migrate instances using the given walker """
    if walker is None:
        migrator = makeMigrator(context, portal_type, meta_type)
        walker = CustomQueryWalker(context, migrator, full_transaction=True)
    else:
        walker = walker(context)
    savepoint(optimistic=True)
    walker.go()
    return walker.getOutput()
开发者ID:tomgross,项目名称:plone.app.blob,代码行数:12,代码来源:migrations.py

示例9: migrateFlowplayerToRedTurtleVideo

# 需要导入模块: from Products.contentmigration.walker import CustomQueryWalker [as 别名]
# 或者: from Products.contentmigration.walker.CustomQueryWalker import go [as 别名]
def migrateFlowplayerToRedTurtleVideo(context):
    from Products.contentmigration.walker import CustomQueryWalker
    migrator = makeMigrator(context, 'ATFile')
    walker = CustomQueryWalker(context, migrator, use_savepoint=True,
                               query={'object_provides': IVideo.__identifier__})
    walker.go()
    output = walker.getOutput()
    migrator = makeMigrator(context, 'ATBlob')
    walker = CustomQueryWalker(context, migrator, use_savepoint=True,
                               query={'object_provides': IVideo.__identifier__})
    walker.go()
    output += walker.getOutput()
    return output.splitlines()
开发者ID:RedTurtle,项目名称:redturtle.video,代码行数:15,代码来源:migrator.py

示例10: __call__

# 需要导入模块: from Products.contentmigration.walker import CustomQueryWalker [as 别名]
# 或者: from Products.contentmigration.walker.CustomQueryWalker import go [as 别名]
 def __call__(self):
     res = 'State before:\n' + self.stats() + '\n'
     portal = self.context
     for migrator in [ATBlobFileToAWSFileMigrator, ATBlobImageToAWSImageMigrator]:
         max_size = self.request.get('max_size')
         def callBefore(obj, **kwargs):
             return obj.get_size() < int(max_size) if max_size else True
         walker = CustomQueryWalker(portal, migrator, callBefore=callBefore, use_savepoint=True)
         if self.request.get('limit'):
             walker.limit = int(self.request.get('limit'))
         transaction.savepoint(optimistic=True)
         walker.go()
         res += walker.getOutput()
     res += 'State after:\n' + self.stats() + '\n'
     portal.plone_log(res)
     return res
开发者ID:quintagroup,项目名称:collective.contentfiles2aws,代码行数:18,代码来源:content_migration.py

示例11: migrate

# 需要导入模块: from Products.contentmigration.walker import CustomQueryWalker [as 别名]
# 或者: from Products.contentmigration.walker.CustomQueryWalker import go [as 别名]
def migrate(self):
    out = StringIO()
    print >> out, "Starting ratings migration"

    portal_url = getToolByName(self, 'portal_url')
    portal = portal_url.getPortalObject()

    # Migrate release count variable
    walker = CustomQueryWalker(portal, RatingsMigrator,
                               query = {'portal_type': 'PSCProject'})
    transaction.savepoint(optimistic=True)
    print >> out, "Switching from contentratings to twothumbs.."
    walker.go(out=out)
    print >> out, walker.getOutput()

    print >> out, "Migration finished"
开发者ID:Conectivo,项目名称:Products.PloneSoftwareCenter,代码行数:18,代码来源:migrateratings.py

示例12: migrateContents

# 需要导入模块: from Products.contentmigration.walker import CustomQueryWalker [as 别名]
# 或者: from Products.contentmigration.walker.CustomQueryWalker import go [as 别名]
def migrateContents(context, src_type, dst_type, src_metatype, dst_metatype, query={}):
    from Products.contentmigration.walker import CustomQueryWalker
    #BBB: i can't find a better way to know if a given portal_type is folderish or not
    is_folderish = False
    temp_obj = context.restrictedTraverse('portal_factory/%s/tmp_id' % src_type)
    if temp_obj:
        plone_view = temp_obj.restrictedTraverse('@@plone')
        if plone_view.isStructuralFolder():
            is_folderish = True
    portal_types = context.portal_types
    src_infos = portal_types.getTypeInfo(src_type)
    dst_infos = portal_types.getTypeInfo(dst_type)
    if is_folderish:
        migrator = makeFolderMigrator(context,
                                     src_type,
                                     dst_type,
                                     src_metatype,
                                     dst_metatype)
    else:
        migrator = makeContentMigrator(context,
                                      src_type,
                                      dst_type,
                                      src_metatype,
                                      dst_metatype)
    if migrator:
        if not src_metatype:
            src_metatype = src_infos.content_meta_type
        if not dst_metatype:
            dst_metatype = dst_infos.content_meta_type
        migrator.src_meta_type = src_metatype
        migrator.dst_meta_type = dst_metatype
        walker = CustomQueryWalker(context, migrator,
                                  src_portal_type=src_type,
                                  dst_portal_type=dst_type,
                                  src_meta_type=src_metatype,
                                  dst_meta_type=dst_metatype,
                                  query=query,
                                  use_savepoint=True)
        walker.go()
        walk_infos = {'error': walker.errors,
                      'msg': walker.getOutput().splitlines(),
                      'counter': walker.counter}
        return walk_infos
开发者ID:RedTurtle,项目名称:rt.atmigrator,代码行数:45,代码来源:migrator.py

示例13: from_1_1_to_1_2

# 需要导入模块: from Products.contentmigration.walker import CustomQueryWalker [as 别名]
# 或者: from Products.contentmigration.walker.CustomQueryWalker import go [as 别名]
def from_1_1_to_1_2(self, out):
    """
    Migrate from 1.1 to 1.2: We now use a field `instructors' instead
    of `instructor', and it contains a list instead of a string.
    """
    if not haveContentMigrations:
        print >> out, "WARNING: Install contentmigrations to be able to migrate from 1.1 to 1.2"
        return

    class InstructorsMigrator(InlineFieldActionMigrator):
        src_portal_type = src_meta_type = (ECL_META,)

        fieldActions = ({ 'fieldName':    'instructor',
                          'newFieldName': 'instructors',
                          'transform':    instructor_to_instructors,
                          },
                        )

    # Migrate instructor field
    portal = getToolByName(self, 'portal_url').getPortalObject()
    walker = CustomQueryWalker(portal, InstructorsMigrator, query={})
    transaction.savepoint(optimistic=True)
    print >> out, "Migrating from instructor to instructors"
    walker.go()
开发者ID:dtgit,项目名称:dtedu,代码行数:26,代码来源:Migrations.py

示例14: migrateSmartLinkToLink

# 需要导入模块: from Products.contentmigration.walker import CustomQueryWalker [as 别名]
# 或者: from Products.contentmigration.walker.CustomQueryWalker import go [as 别名]
def migrateSmartLinkToLink(context):
    from Products.contentmigration.walker import CustomQueryWalker
    migrator = makeMigrator(context, 'Link', 'ATLink')
    walker = CustomQueryWalker(context, migrator, callBefore=isSmartLink, use_savepoint=True)
    walker.go()
    return walker.getOutput().splitlines()
开发者ID:RedTurtle,项目名称:redturtle.smartlink,代码行数:8,代码来源:migrator.py

示例15: v1beta7_v1beta8

# 需要导入模块: from Products.contentmigration.walker import CustomQueryWalker [as 别名]
# 或者: from Products.contentmigration.walker.CustomQueryWalker import go [as 别名]
def v1beta7_v1beta8(self, out):
    """Migrate from beta 7 to beta 8
    """

    if not haveContentMigrations:
        print >> out, "WARNING: Install contentmigrations to be able to migrate from v1 beta 7 to beta 8"
        return

    class ReleaseStateMigrator(BaseInlineMigrator):
        src_portal_type = src_meta_type = 'PSCRelease'

        stateMap = {'final' : 'final',
                    'rc'    : 'release-candidate',
                    'beta'  : 'beta',
                    'alpha' : 'alpha',
                    'in progress' : 'pre-release',
                    'in-progress' : 'pre-release'}

        def migrate_releaseState(self):
            maturity = getattr(aq_base(self.obj), 'maturity', None)
            wftool = getToolByName(self.obj, 'portal_workflow')
            wfdef = getattr(aq_base(wftool), 'psc_release_workflow', None)
            if maturity is not None and wfdef is not None:
                maturity = str(maturity)
                state = self.stateMap.get(maturity.lower(), 'pre-release')
                wfstate = {'action'       : None,
                           'actor'        : None,
                           'comments'     : 'Updated by migration; maturity was ' + maturity,
                           'review_state' : state,
                           'time'         : DateTime()}
                wftool.setStatusOf('psc_release_workflow', self.obj, wfstate)
                wfdef.updateRoleMappingsFor(self.obj)
                self.obj.reindexObject()

    class ReleaseCountMigrator(BaseInlineMigrator):
        src_portal_type = src_meta_type = 'PSCProject'

        def migrate_releaseCount(self):
            releaseCount = getattr(aq_base(self.obj), 'releaseCount', None)
            catalog = getToolByName(self.obj, 'portal_catalog')
            releases = catalog.searchResults(portal_type = 'PSCRelease',
                                             review_state = ('alpha', 'beta', 'release-candidate', 'final',),
                                             path = '/'.join(self.obj.getPhysicalPath()))
            if releaseCount is None:
                self.obj.manage_addProperty('releaseCount', len(releases), 'int')
            else:
                self.obj.manage_changeProperties(releaseCount = len(releases))
            self.obj.reindexObject()

    portal = getToolByName(self, 'portal_url').getPortalObject()

    # Migrate release state
    walker = CustomQueryWalker(portal, ReleaseStateMigrator, query = {})
    transaction.savepoint(optimistic=True)
    print >> out, "Migrating from field-based maturity to workflow-based maturity"
    walker.go()

    # Migrate release count variable
    walker = CustomQueryWalker(portal, ReleaseCountMigrator, query = {})
    transaction.savepoint(optimistic=True)
    print >> out, "Adding release count property"
    walker.go()
开发者ID:Conectivo,项目名称:Products.PloneSoftwareCenter,代码行数:64,代码来源:Migrations.py


注:本文中的Products.contentmigration.walker.CustomQueryWalker.go方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。