本文整理汇总了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)
示例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:
示例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)
示例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