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

All Samples(9)  |  Call(5)  |  Derive(0)  |  Import(4)
Select the policy implementation to use. The 'name' must be either
'PYTHON' or 'C'. NOTE: this function is intended to be called
exactly once, so that the Zope config file can dictate the policy
implementation to be used. Subsequent calls to this function will
have no effect!!

        def setImplementation(name):
    """Select the policy implementation to use. The 'name' must be either
       'PYTHON' or 'C'. NOTE: this function is intended to be called
       exactly once, so that the Zope config file can dictate the policy
       implementation to be used. Subsequent calls to this function will
       have no effect!!
    """
    import sys
    global _implementation_name
    global _implementation_set

    if _implementation_set:
        return

    name = name.upper()
    if name == _implementation_name:
        return
    if name == "C":
        from AccessControl import ImplC as impl
    elif name == "PYTHON":
        from AccessControl import ImplPython as impl
    else:
        raise ValueError("unknown policy implementation: %r" % name)

    _implementation_name = name
    for modname, names in _policy_names.items():
        __import__(modname)
        mod = sys.modules[modname]
        for n in names:
            setattr(mod, n, getattr(impl, n))
        if hasattr(mod, "initialize"):
            mod.initialize(impl)

    from AccessControl.SecurityManager import setSecurityPolicy
    policy = impl.ZopeSecurityPolicy(True, True)
    setSecurityPolicy(policy)

    _implementation_set = 1
        


src/a/c/AccessControl-3.0.8/src/AccessControl/__init__.py   AccessControl(Download)
 
# This has to happen early so things get initialized properly
from AccessControl.Implementation import setImplementation
 
from AccessControl.SecurityManagement import getSecurityManager

src/a/c/AccessControl-3.0.8/src/AccessControl/tests/testImplementation.py   AccessControl(Download)
 
from AccessControl.Implementation import getImplementationName
from AccessControl.Implementation import setImplementation
 
 
    def tearDown(self):
        setImplementation(self.original)
 
## Note - this test is disabled because the intent for 2.7 was *not*
## to support the ability to arbitrarily switch the security policy

src/e/r/erp5-HEAD/product/ERP5/tests/testERP5Credential.py   erp5(Download)
if use_verbose_security:
  import AccessControl
  AccessControl.Implementation.setImplementation('python')
  AccessControl.ImplPython.setDefaultBehaviors(
              ownerous=True,

src/a/c/AccessControl-3.0.8/src/AccessControl/tests/testZopeSecurityPolicy.py   AccessControl(Download)
    def _resetImplementation(self, implementation_name):
        from AccessControl import Implementation
        Implementation._implementation_name = None
        Implementation._implementation_set = 0
        Implementation.setImplementation(implementation_name)

src/p/l/plone.testing-4.0.11/src/plone/testing/z2.py   plone.testing(Download)
 
        # Set Python security mode
        from AccessControl.Implementation import setImplementation
        setImplementation("Python")
 
    def tearDownDebugMode(self):
        """Return the debug mode flag to its previous state
        """
 
        from AccessControl.Implementation import setImplementation
        setImplementation("C")