本文整理匯總了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