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

All Samples(81)  |  Call(49)  |  Derive(0)  |  Import(32)
Allow a class and all of its methods to be used from a
restricted Script.  The argument Class must be a class.

        def allow_class(Class):
    """Allow a class and all of its methods to be used from a
    restricted Script.  The argument Class must be a class."""
    Class._security = sec = ClassSecurityInfo()
    sec.declareObjectPublic()
    sec.setDefaultAccess(1)
    sec.apply(Class)
    InitializeClass(Class)
        


src/p/r/Products.PythonScripts-2.13.2/src/Products/PythonScripts/module_access_examples.py   Products.PythonScripts(Download)
'''
 
from AccessControl import allow_module, allow_class, allow_type
from AccessControl import ModuleSecurityInfo
 

src/p/r/Products.CMFPlone-5.0a2/Products/CMFPlone/__init__.py   Products.CMFPlone(Download)
 
    from AccessControl import ModuleSecurityInfo
    from AccessControl import allow_module, allow_class
 
    # protect OFS.ObjectManager
    ModuleSecurityInfo('logging').declarePublic('getLogger')
    from logging import Logger
    allow_class(Logger)
 
    # various small utils functions
    ModuleSecurityInfo('Products.CMFCore.WorkflowCore') \
        .declarePublic('WorkflowException')
    allow_class(ObjectMoved)
    allow_class(ObjectDeleted)
    allow_class(WorkflowException)

src/p/r/Products.CMFPlone-HEAD/Products/CMFPlone/__init__.py   Products.CMFPlone(Download)
 
    from AccessControl import ModuleSecurityInfo
    from AccessControl import allow_module, allow_class
 
    # protect OFS.ObjectManager
    ModuleSecurityInfo('logging').declarePublic('getLogger')
    from logging import Logger
    allow_class(Logger)
 
    # various small utils functions
    ModuleSecurityInfo('Products.CMFCore.WorkflowCore') \
        .declarePublic('WorkflowException')
    allow_class(ObjectMoved)
    allow_class(ObjectDeleted)
    allow_class(WorkflowException)

src/e/r/erp5-HEAD/product/ERP5Type/ZipFile.py   erp5(Download)
From restricted python, use "import zipfile" (see patches/Restricted.py).
"""
from AccessControl import allow_class as _allow_class
from zExceptions import Unauthorized
import zipfile as _zipfile
 
BadZipfile = _zipfile.BadZipfile
_allow_class(BadZipfile)
LargeZipFile = _zipfile.LargeZipFile
_allow_class(LargeZipFile)
 
ZipInfo = _zipfile.ZipInfo
_allow_class(ZipInfo)
ZipExtFile = _zipfile.ZipExtFile
_allow_class(ZipExtFile)

src/t/e/tecnoteca.googlemap-1.2/tecnoteca/googlemap/__init__.py   tecnoteca.googlemap(Download)
    """
 
    from AccessControl import allow_module, allow_class
    allow_module('tecnoteca.googlemap.content')
 
    from tecnoteca.googlemap.content.ttgooglemapcoordinates import TTGoogleMapCoordinates
    allow_class(TTGoogleMapCoordinates)
 
    from tecnoteca.googlemap.browser.logger import log
    allow_class(log)

src/e/r/erp5-HEAD/product/MailTemplates/__init__.py   erp5(Download)
# See license.txt for more details.
 
from AccessControl import allow_module,allow_class
from Products.PageTemplates.PageTemplateFile import PageTemplateFile
from MailTemplate import MailTemplate
            obj = getattr(mod,mod_name)
            if isinstance(obj,ClassType):
                allow_class(obj)
 
 

src/e/r/erp5-HEAD/product/ERP5Type/Calendar.py   erp5(Download)
From restricted python, use "import calendar" (see patches/Restricted.py).
"""
from AccessControl import allow_class as _allow_class
from zExceptions import Unauthorized
import calendar as _calendar
 
Calendar = _calendar.Calendar
_allow_class(Calendar)
 
HTMLCalendar = _calendar.HTMLCalendar
_allow_class(HTMLCalendar)
  prmonth = _disallowed
  pryear = _disallowed
_allow_class(TextCalendar)
 

src/p/r/Products.Formulator-1.15.5/Products/Formulator/monkey.py   Products.Formulator(Download)
# -*- coding: utf-8 -*-
# Copyright (c) 2013  Infrae. All rights reserved.
# See also LICENSE.txt
from AccessControl import allow_class, allow_module
 
        from zope.i18nmessageid.messageid import MessageID
        # open it up for Zope 2...
        allow_class(MessageID)
    except ImportError:
        # Zope since 2.10: we dont have to allow "Message", it seems

src/e/n/enpraxis.educommons-4.1.2/enpraxis/educommons/__init__.py   enpraxis.educommons(Download)
from Products.Archetypes.atapi import process_types, listTypes
from Products.CMFCore.DirectoryView import registerDirectory
from AccessControl import allow_module, allow_class
from collective.captcha.browser.captcha import Captcha
from zope.i18nmessageid import MessageFactory
from enpraxis.educommons.loadtesttool import LoadTestTool
 
allow_module('collective.captcha.browser.captcha')
allow_class(Captcha)

src/p/r/Products.Archetypes-1.10.1/Products/Archetypes/__init__.py   Products.Archetypes(Download)
 
from AccessControl import ModuleSecurityInfo
from AccessControl import allow_class, allow_module
from Products.CMFCore import permissions
 
# make DisplayList accessible from python scripts and others objects executed
# in a restricted environment
allow_class(DisplayList)
 
# Allow import of NotFound exception

  1 | 2 | 3 | 4  Next