Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(9)  |  Call(0)  |  Derive(0)  |  Import(9)
Protect the attribute 'name' on 'klass' using the given
permission

        def protectName(klass, name, permission_id, override_existing_protection=True):
    """Protect the attribute 'name' on 'klass' using the given
       permission"""
    security = _getSecurity(klass)
    # Zope 2 uses string, not unicode yet
    name = str(name)
    if not override_existing_protection and ('%s__roles__' % name) in dir(klass):
        # There is already a declaration for this name from a base class.
        return
    if permission_id == CheckerPublicId or permission_id is CheckerPublic:
        # Sometimes, we already get a processed permission id, which
        # can mean that 'zope.Public' has been interchanged for the
        # CheckerPublic object
        security.declarePublic(name)
    elif permission_id == CheckerPrivateId:
        security.declarePrivate(name)
    else:
        permission = getUtility(IPermission, name=permission_id)
        # Zope 2 uses string, not unicode yet
        perm = str(permission.title)
        security.declareProtected(perm, name)
        


src/z/o/Zope2-2.13.22/src/Products/Five/browser/metaconfigure.py   Zope2(Download)
from AccessControl.security import getSecurityInfo
from AccessControl.security import protectClass
from AccessControl.security import protectName
from AccessControl.security import CheckerPrivateId
 

src/z/o/Zope-HEAD/src/Products/Five/browser/metaconfigure.py   Zope(Download)
from AccessControl.security import getSecurityInfo
from AccessControl.security import protectClass
from AccessControl.security import protectName
from AccessControl.security import CheckerPrivateId
 

src/p/r/Products.jsonserver-1.2b6/Products/jsonserver/metaconfigure.py   Products.jsonserver(Download)
    from AccessControl.security import getSecurityInfo
    from AccessControl.security import protectClass
    from AccessControl.security import protectName
    from App.class_init import InitializeClass
except ImportError:  # Zope < 2.13

src/p/l/plone.directives.dexterity-1.0.2/plone/directives/dexterity/form.py   plone.directives.dexterity(Download)
 
try:
    from AccessControl.security import protectClass, protectName
    from AccessControl.security import CheckerPrivateId
    protectClass, protectName, CheckerPrivateId  # pyflakes

src/z/o/Zope2-2.13.22/src/Products/Five/viewlet/metaconfigure.py   Zope2(Download)
from AccessControl.class_init import InitializeClass
from AccessControl.security import protectClass
from AccessControl.security import protectName
 
from Products.Five.viewlet import manager

src/z/o/Zope-HEAD/src/Products/Five/viewlet/metaconfigure.py   Zope(Download)
from AccessControl.class_init import InitializeClass
from AccessControl.security import protectClass
from AccessControl.security import protectName
 
from Products.Five.viewlet import manager

src/f/i/five.grok-1.3.2/src/five/grok/meta.py   five.grok(Download)
import martian
 
from AccessControl.security import protectClass, protectName
from App.class_init import InitializeClass as initializeClass
 

src/a/c/AccessControl-3.0.8/src/AccessControl/metaconfigure.py   AccessControl(Download)
from zope.security import metaconfigure
from AccessControl.class_init import InitializeClass
from AccessControl.security import protectName
 
class ClassDirective(metaconfigure.ClassDirective):

src/p/l/plone.directives.dexterity-1.0.2/plone/directives/dexterity/tests/test_form.py   plone.directives.dexterity(Download)
# Determine which methods to mock:
try:
    from AccessControl.security import protectClass, protectName
    protectClass, protectName  # pyflakes
except ImportError: