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


Python ModuleSecurityInfo.declarePrivate方法代码示例

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


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

示例1: setDefaultRoles

# 需要导入模块: from AccessControl.SecurityInfo import ModuleSecurityInfo [as 别名]
# 或者: from AccessControl.SecurityInfo.ModuleSecurityInfo import declarePrivate [as 别名]
security.declarePublic('UndoChanges')
UndoChanges = Permissions.undo_changes

security.declarePublic('View')
View = Permissions.view

security.declarePublic('ViewManagementScreens')
ViewManagementScreens = Permissions.view_management_screens

addPermission = None
try:
    from AccessControl.Permission import addPermission
except ImportError:
    pass

security.declarePrivate('setDefaultRoles')
def setDefaultRoles(permission, roles):
    '''
    Sets the defaults roles for a permission.
    '''
    if addPermission is not None:
        addPermission(permission, roles)
    else:
        # BBB This is in AccessControl starting in Zope 2.13
        import Products
        registered = _registeredPermissions
        if not registered.has_key(permission):
            registered[permission] = 1
            Products.__ac_permissions__=(
                Products.__ac_permissions__+((permission,(),roles),))
            mangled = pname(permission)
开发者ID:c0ns0le,项目名称:zenoss-4,代码行数:33,代码来源:permissions.py

示例2: ModuleSecurityInfo

# 需要导入模块: from AccessControl.SecurityInfo import ModuleSecurityInfo [as 别名]
# 或者: from AccessControl.SecurityInfo.ModuleSecurityInfo import declarePrivate [as 别名]
from zope.component import queryUtility
from zope import i18n # disambiguation
from zope.i18n.interfaces import IUserPreferredCharsets
from zope.i18nmessageid import MessageFactory
from zope.publisher.interfaces.browser import IBrowserRequest

from Products.CMFCore.interfaces import IPropertiesTool

from Products.CMFDefault.interfaces import IHTMLScrubber
from Products.CMFDefault.exceptions import EmailAddressInvalid
from Products.CMFDefault.exceptions import IllegalHTML


security = ModuleSecurityInfo( 'Products.CMFDefault.utils' )

security.declarePrivate('_dtmldir')
_dtmldir = os.path.join( package_home( globals() ), 'dtml' )
_wwwdir = os.path.join( package_home( globals() ), 'www' )

security.declarePublic('formatRFC822Headers')
def formatRFC822Headers( headers ):

    """ Convert the key-value pairs in 'headers' to valid RFC822-style
        headers, including adding leading whitespace to elements which
        contain newlines in order to preserve continuation-line semantics.
    """
    munged = []
    linesplit = re.compile( r'[\n\r]+?' )

    for key, value in headers:
开发者ID:CGTIC,项目名称:Plone_SP,代码行数:32,代码来源:utils.py

示例3: ModuleSecurityInfo

# 需要导入模块: from AccessControl.SecurityInfo import ModuleSecurityInfo [as 别名]
# 或者: from AccessControl.SecurityInfo.ModuleSecurityInfo import declarePrivate [as 别名]
SUBTEMPLATE = '__SUBTEMPLATE__'

security = ModuleSecurityInfo( 'Products.CMFCore.utils' )

_globals = globals()
_dtmldir = os_path.join( package_home( globals() ), 'dtml' )
_wwwdir = os_path.join( package_home( globals() ), 'www' )

#
#   Simple utility functions, callable from restricted code.
#
_marker = []  # Create a new marker object.

_tool_interface_registry = {}

security.declarePrivate('registerToolInterface')
def registerToolInterface(tool_id, tool_interface):
    """ Register a tool ID for an interface

    This method can go away when getToolByName is going away (CMF 2.3).
    """
    global  _tool_interface_registry
    _tool_interface_registry[tool_id] = tool_interface

security.declarePrivate('getToolInterface')
def getToolInterface(tool_id):
    """ Get the interface registered for a tool ID
    """
    global  _tool_interface_registry
    return _tool_interface_registry.get(tool_id, None)
开发者ID:goschtl,项目名称:zope,代码行数:32,代码来源:utils.py

示例4: setDefaultRoles

# 需要导入模块: from AccessControl.SecurityInfo import ModuleSecurityInfo [as 别名]
# 或者: from AccessControl.SecurityInfo.ModuleSecurityInfo import declarePrivate [as 别名]
security.declarePublic("UndoChanges")
UndoChanges = Permissions.undo_changes

security.declarePublic("View")
View = Permissions.view

security.declarePublic("ViewManagementScreens")
ViewManagementScreens = Permissions.view_management_screens

addPermission = None
try:
    from AccessControl.Permission import addPermission
except ImportError:
    pass

security.declarePrivate("setDefaultRoles")


def setDefaultRoles(permission, roles):
    """
    Sets the defaults roles for a permission.
    """
    if addPermission is not None:
        addPermission(permission, roles)
    else:
        # BBB This is in AccessControl starting in Zope 2.13
        import Products

        registered = _registeredPermissions
        if not registered.has_key(permission):
            registered[permission] = 1
开发者ID:pigaov10,项目名称:plone4.3,代码行数:33,代码来源:permissions.py


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