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


Python PluginRegistry._setId方法代码示例

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


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

示例1: __call__

# 需要导入模块: from Products.PluginRegistry.PluginRegistry import PluginRegistry [as 别名]
# 或者: from Products.PluginRegistry.PluginRegistry.PluginRegistry import _setId [as 别名]
    def __call__(self, object_id):
        from Products.PluginRegistry.PluginRegistry import PluginRegistry

        registry = PluginRegistry(())
        registry._setId(object_id)
        self.context._setObject(object_id, registry)
        return registry
开发者ID:dtgit,项目名称:dtedu,代码行数:9,代码来源:exportimport.py

示例2: _makePlugins

# 需要导入模块: from Products.PluginRegistry.PluginRegistry import PluginRegistry [as 别名]
# 或者: from Products.PluginRegistry.PluginRegistry.PluginRegistry import _setId [as 别名]
    def _makePlugins(self, plugin_type_info=None):

        from Products.PluggableAuthService.PluggableAuthService \
            import _PLUGIN_TYPE_INFO
        from Products.PluginRegistry.PluginRegistry import PluginRegistry

        if plugin_type_info is None:
            plugin_type_info = _PLUGIN_TYPE_INFO

        reg = PluginRegistry(plugin_type_info=plugin_type_info)
        reg._setId('plugins')
        reg._plugins = {}

        return reg
开发者ID:plone,项目名称:Products.PluggableAuthService,代码行数:16,代码来源:test_Caching.py

示例3: addPluggableAuthService

# 需要导入模块: from Products.PluginRegistry.PluginRegistry import PluginRegistry [as 别名]
# 或者: from Products.PluginRegistry.PluginRegistry.PluginRegistry import _setId [as 别名]
def addPluggableAuthService( dispatcher, REQUEST=None ):

    """ Add a PluggableAuthService to 'self.
    """
    pas = PluggableAuthService()
    preg = PluginRegistry( _PLUGIN_TYPE_INFO )
    preg._setId( 'plugins' )
    pas._setObject( 'plugins', preg )
    dispatcher._setObject( pas.getId(), pas )


    if REQUEST is not None:
        REQUEST['RESPONSE'].redirect(
                                '%s/manage_workspace'
                                '?manage_tabs_message='
                                'PluggableAuthService+added.'
                              % dispatcher.absolute_url() )
开发者ID:goschtl,项目名称:zope,代码行数:19,代码来源:PluggableAuthService.py

示例4: addConfiguredPAS

# 需要导入模块: from Products.PluginRegistry.PluginRegistry import PluginRegistry [as 别名]
# 或者: from Products.PluginRegistry.PluginRegistry.PluginRegistry import _setId [as 别名]
def addConfiguredPAS( dispatcher
                    , base_profile
                    , extension_profiles=()
                    , create_snapshot=True
                    , setup_tool_id='setup_tool'
                    , REQUEST=None
                    ):
    """ Add a PluggableAuthService to 'self.
    """
    from Products.GenericSetup.tool import SetupTool

    pas = PluggableAuthService()
    preg = PluginRegistry( _PLUGIN_TYPE_INFO )
    preg._setId( 'plugins' )
    pas._setObject( 'plugins', preg )
    dispatcher._setObject( pas.getId(), pas )

    pas = dispatcher._getOb( pas.getId() )    # wrapped
    tool = SetupTool( setup_tool_id )
    pas._setObject( tool.getId(), tool )

    tool = pas._getOb( tool.getId() )       # wrapped
    tool.setImportContext( 'profile-%s' % base_profile )
    tool.runAllImportSteps()

    for extension_profile in extension_profiles:
        tool.setImportContext( 'profile-%s' % extension_profile )
        tool.runAllImportSteps()

    tool.setImportContext( 'profile-%s' % base_profile )

    if create_snapshot:
        tool.createSnapshot( 'initial_configuration' )

    if REQUEST is not None:
        REQUEST['RESPONSE'].redirect(
                                '%s/manage_workspace'
                                '?manage_tabs_message='
                                'PluggableAuthService+added.'
                              % dispatcher.absolute_url() )
开发者ID:goschtl,项目名称:zope,代码行数:42,代码来源:PluggableAuthService.py

示例5: _replaceUserFolder

# 需要导入模块: from Products.PluginRegistry.PluginRegistry import PluginRegistry [as 别名]
# 或者: from Products.PluginRegistry.PluginRegistry.PluginRegistry import _setId [as 别名]
def _replaceUserFolder(self, RESPONSE=None):
    """replaces the old acl_users folder with a PluggableAuthService,
    preserving users and passwords, if possible
    """
    from Acquisition import aq_base
    from Products.PluggableAuthService.PluggableAuthService \
        import PluggableAuthService, _PLUGIN_TYPE_INFO
    from Products.PluginRegistry.PluginRegistry import PluginRegistry
    from Products.PluggableAuthService.plugins.ZODBUserManager \
        import ZODBUserManager
    from Products.PluggableAuthService.plugins.ZODBRoleManager \
        import ZODBRoleManager
    from Products.PluggableAuthService.interfaces.plugins \
         import IAuthenticationPlugin, IUserEnumerationPlugin
    from Products.PluggableAuthService.interfaces.plugins \
        import IRolesPlugin, IRoleEnumerationPlugin, IRoleAssignerPlugin

    if getattr( aq_base(self), '__allow_groups__', None ):
        if self.__allow_groups__.__class__ is PluggableAuthService:
            _write( RESPONSE
                  , 'replaceUserFolder'
                  , 'Already replaced this user folder\n' )
            return
        old_acl = self.__allow_groups__
        new_acl = PluggableAuthService()
        preg = PluginRegistry( _PLUGIN_TYPE_INFO )
        preg._setId( 'plugins' )
        new_acl._setObject( 'plugins', preg )
        self._setObject( 'new_acl_users', new_acl )
        new_acl = getattr( self, 'new_acl_users' )

        user_folder = ZODBUserManager( 'users' )
        new_acl._setObject( 'users', user_folder )
        role_manager = ZODBRoleManager( 'roles' )
        new_acl._setObject( 'roles', role_manager )

        plugins = getattr( new_acl, 'plugins' )
        plugins.activatePlugin( IAuthenticationPlugin, 'users' )
        plugins.activatePlugin( IUserEnumerationPlugin, 'users' )
        plugins.activatePlugin( IRolesPlugin, 'roles' )
        plugins.activatePlugin( IRoleEnumerationPlugin, 'roles' )
        plugins.activatePlugin( IRoleAssignerPlugin, 'roles' )
        for user_name in old_acl.getUserNames():
            old_user = old_acl.getUser( user_name )
            _write( RESPONSE
                  , 'replaceRootUserFolder'
                  , 'Translating user %s\n' % user_name )
            _migrate_user( new_acl.users, user_name, old_user._getPassword() )
            new_user = new_acl.getUser( user_name )
            for role_id in old_user.getRoles():
                if role_id not in ['Authenticated', 'Anonymous']:
                    new_acl.roles.assignRoleToPrincipal( role_id,
                                                         new_user.getId() )
        self._delObject( 'acl_users' )
        self._setObject( 'acl_users', aq_base( new_acl ) )
        self._delObject( 'new_acl_users' )
        self.__allow_groups__ = aq_base( new_acl )
        _write( RESPONSE
              , 'replaceRootUserFolder'
              , 'Replaced root acl_users with PluggableAuthService\n' )

    get_transaction().commit()
开发者ID:goschtl,项目名称:zope,代码行数:64,代码来源:upgrade.py


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