def initialize(context): from intranett.policy import config config.config.register_profile() config.config.register_profile(profile_name='content') config.config.scan() from AccessControl import allow_module allow_module('intranett.policy.config') from Products.Archetypes import atapi from Products.CMFCore import utils # Register content from intranett.policy.content import membersfolder from intranett.policy.content import projectroom membersfolder # pyflakes projectroom # pyflakes content_types, constructors, ftis = atapi.process_types( atapi.listTypes(config.PROJECTNAME), config.PROJECTNAME) for atype, constructor in zip(content_types, constructors): utils.ContentInit('%s: %s' % (config.PROJECTNAME, atype.portal_type), content_types=(atype, ), permission=config.ADD_PERMISSIONS[atype.portal_type], extra_constructors=(constructor, ), ).initialize(context)
def initialize(context): """Initializer called when used as a Zope 2 product.""" from AccessControl import ModuleSecurityInfo from AccessControl import allow_module, allow_class allow_module('recensio.policy.utility') ModuleSecurityInfo('recensio.policy.utility').declarePublic('getMemberInfo')
def initialize(context): from Products.Extropy import content content_types, constructors, ftis = process_types(listTypes(config.PROJECTNAME), config.PROJECTNAME) ContentInit( config.PROJECTNAME + " Content", content_types=content_types, permission=config.ADD_CONTENT_PERMISSION, extra_constructors=constructors, ).initialize(context) TOOLS = (tools.ExtropyTimeTrackerTool.ExtropyTimeTrackerTool, tools.ExtropyTrackingTool.ExtropyTrackingTool) ToolInit(config.PROJECTNAME + " Tool", tools=TOOLS, icon="tool.gif").initialize(context) import patches allow_module("Products.Extropy.odict") from Products.Extropy.odict import OrderedDict allow_class(OrderedDict) from Products.CMFPlone import i18nl10n i18nl10n.setDefaultDateFormat(("en",), u"yyyy-MM-dd") i18nl10n.setDefaultTimeFormat(("en",), u"HH:mm:ss")
def initialize(context): """Initializer called when used as a Zope 2 product.""" allow_module('collective.pwexpiry.config') registerMultiPlugin(pwexpiry_plugin.PwExpiryPlugin.meta_type) context.registerClass( pwexpiry_plugin.PwExpiryPlugin, permission=add_user_folders, constructors=( pwexpiry_plugin.manage_addPwExpiryPluginForm, pwexpiry_plugin.addPwExpiryPlugin ), visibility=None ) registerMultiPlugin(pwdisable_plugin.PwDisablePlugin.meta_type) context.registerClass( pwdisable_plugin.PwDisablePlugin, permission=add_user_folders, constructors=( pwdisable_plugin.manage_addPwDisablePluginForm, pwdisable_plugin.addPwDisablePlugin ), visibility=None )
def test_zpt_security(self): from AccessControl import allow_module allow_module('smtpd') self.logout() view = self.folder.unrestrictedTraverse('testoid/security.html') expected = """\ <div>NoneType</div> <div>smtpd</div> """ self.assertEquals(expected, view())
def monkey_zope3_message_id(): try: #BBB Zope 2.9 and earlier 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 from zope.i18nmessageid.message import Message # allow_class(Message) # instead we have to allow the module ... allow_module('zope.i18nmessageid.message')
def initialize(context): """Product Initialization """ import patch, patch_cmf, patch_five patch.run() patch_cmf.run() patch_five.run() tools = (CacheTool, CSCachingPolicyManager) try: cmfutils.ToolInit( config.PROJECT_NAME + ' Tool', tools = tools, icon = 'cachesetup_tool_icon.gif', ).initialize(context) except TypeError: cmfutils.ToolInit( config.PROJECT_NAME + ' Tool', tools = tools, product_name = config.PROJECT_NAME, icon = 'cachesetup_tool_icon.gif', ).initialize(context) allow_module('Products.CacheSetup.config') # Ask Archetypes to handback all the type information needed # to make the CMF happy. types = atapi.listTypes(config.PROJECT_NAME) content_types, constructors, ftis = \ atapi.process_types(types, config.PROJECT_NAME) permissions = initialize_permissions() # We want to register each each type with its own permission, # this will afford us greater control during system # configuration/deployment (and is a good recipe) # The pattern used here will create many item options in ZMI # menus, but is the only way that allows for things to still be # selectable in the UI. If they all had the same name, only the # first would be found. permissions = initialize_permissions() allTypes = zip(content_types, constructors) for atype, constructor in allTypes: cmfutils.ContentInit( atype.meta_type, content_types = (atype,), permission = permissions[atype.portal_type], extra_constructors = (constructor,), fti = ftis, ).initialize(context)
def initialize(context): # register the CMFMember migrators, if necessary if config.CMFMEMBER_MIGRATION_SUPPORT: registerMigrators() # Register a PAS plugin pas_install.register_pas_plugin_class(context) # Some methods are needed in restricted python: allow_module('Products.remember.pas.utils') # Importing the content types allows for their registration # with the Archetypes runtime import content content # pyflakes # Ask Archetypes to handback all the type information needed # to make the CMF happy. types = atapi.listTypes(config.PROJECT_NAME) content_types, constructors, ftis = \ atapi.process_types(types, config.PROJECT_NAME) # We register each type with an add permission that is set # in permissions.py. By default, each content type has its # own permission, but this behavior can be easily overridden. permissions = initialize_permissions() allTypes = zip(content_types, constructors) for atype, constructor in allTypes: kind = "%s: %s" % (config.PROJECT_NAME, atype.archetype_name) cmf_utils.ContentInit( kind, content_types=(atype, ), permission=permissions[atype.portal_type], extra_constructors=(constructor, ), fti=ftis, ).initialize(context) profile_registry.registerProfile('uninstall', 'uninstall remember', 'Uninstall remember.', 'profiles/uninstall', 'remember', EXTENSION, for_=ISiteRoot, ) # register image property type for user property sheets PropertySchema.addType('image', lambda x: x is None or isinstance(x, Image))
def initialize(context): from AccessControl import allow_module allow_module('Products.qPingTool.util') utils.ToolInit("PingTool", tools=tools, product_name=PROJECTNAME, icon=TOOL_ICON, ).initialize(context) content_types, constructors, ftis = process_types(listTypes(PROJECTNAME), PROJECTNAME) utils.ContentInit( PROJECTNAME + ' Content', content_types = content_types, permission = ADD_PERMISSION, extra_constructors = constructors, fti = ftis, ).initialize(context)
def initialize(context): """Initializer called when used as a Zope 2 product.""" from AccessControl import allow_module allow_module('slc.alertservice.utils') import AlertserviceTool tools = (AlertserviceTool.AlertserviceTool, ) from Products.CMFPlone.utils import ToolInit # Register tools and content ToolInit('Alertservice Tool' , tools=tools , icon='skins/alertservice/alertservice_icon.gif' ).initialize( context )
def initialize(context): # Import the type, which results in registerType() being called import MailmanSubForm # initialize the content, including types and add permissions content_types, constructors, ftis = process_types(listTypes(PROJECTNAME), PROJECTNAME) utils.ContentInit( PROJECTNAME + ' Content', content_types=content_types, permission=DEFAULT_ADD_CONTENT_PERMISSION, extra_constructors=constructors, fti=ftis, ).initialize(context) allow_module('Products.MailmanSubForm.MailmanSubFormMessage')
def initialize(context): """Initializer called when used as a Zope 2 product. This is referenced from configure.zcml. Regstrations as a "Zope 2 product" is necessary for GenericSetup profiles to work, for example. Here, we call the Archetypes machinery to register our content types with Zope and the CMF. """ 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) # Retrieve the content types that have been registered with Archetypes # This happens when the content type is imported and the registerType() # call in the content type's module is invoked. Actually, this happens # during ZCML processing, but we do it here again to be explicit. Of # course, even if we import the module several times, it is only run # once. content_types, constructors, ftis = atapi.process_types( atapi.listTypes(config.PROJECTNAME), config.PROJECTNAME) # Now initialize all these content types. The initialization process takes # care of registering low-level Zope 2 factories, including the relevant # add-permission. These are listed in config.py. We use different # permissions for each content type to allow maximum flexibility of who # can add which content types, where. The roles are set up in rolemap.xml # in the GenericSetup profile. for atype, constructor in zip(content_types, constructors): utils.ContentInit('%s: %s' % (config.PROJECTNAME, atype.portal_type), content_types=(atype, ), permission=config.ADD_PERMISSIONS[atype.portal_type], extra_constructors=(constructor,), ).initialize(context)
def initialize(context): # Import the type, which results in registerType() being called import MailmanSubForm # initialize the content, including types and add permissions content_types, constructors, ftis = process_types( listTypes(PROJECTNAME), PROJECTNAME) utils.ContentInit( PROJECTNAME + ' Content', content_types = content_types, permission = DEFAULT_ADD_CONTENT_PERMISSION, extra_constructors = constructors, fti = ftis, ).initialize(context) allow_module('Products.MailmanSubForm.MailmanSubFormMessage')
def initialize(context): from AccessControl import allow_module allow_module('zope.component') allow_module("pdb") # imports packages and types for registration import easyshop.carts.content import easyshop.catalog.content import easyshop.criteria.content import easyshop.customers.content import easyshop.groups.content import easyshop.information.content import easyshop.payment.content import easyshop.order.content import easyshop.shipping.content import easyshop.taxes.content import content import catalog # Initialize portal content all_content_types, all_constructors, all_ftis = process_types( listTypes(PROJECTNAME), PROJECTNAME) cmfutils.ContentInit( PROJECTNAME + ' Content', content_types = all_content_types, permission = DEFAULT_ADD_CONTENT_PERMISSION, extra_constructors = all_constructors, fti = all_ftis, ).initialize(context) # Give it some extra permissions to control them on a per class limit for i in range(0,len(all_content_types)): klassname=all_content_types[i].__name__ if not klassname in ADD_CONTENT_PERMISSIONS: continue context.registerClass(meta_type = all_ftis[i]['meta_type'], constructors= (all_constructors[i],), permission = ADD_CONTENT_PERMISSIONS[klassname])
def initialize(context): from AccessControl import allow_module allow_module('zope.component') allow_module("pdb") # imports packages and types for registration import easyshop.carts.content import easyshop.catalog.content import easyshop.criteria.content import easyshop.customers.content import easyshop.groups.content import easyshop.information.content import easyshop.payment.content import easyshop.order.content import easyshop.shipping.content import easyshop.taxes.content import content import catalog # Initialize portal content all_content_types, all_constructors, all_ftis = process_types( listTypes(PROJECTNAME), PROJECTNAME) cmfutils.ContentInit( PROJECTNAME + ' Content', content_types=all_content_types, permission=DEFAULT_ADD_CONTENT_PERMISSION, extra_constructors=all_constructors, fti=all_ftis, ).initialize(context) # Give it some extra permissions to control them on a per class limit for i in range(0, len(all_content_types)): klassname = all_content_types[i].__name__ if not klassname in ADD_CONTENT_PERMISSIONS: continue context.registerClass(meta_type=all_ftis[i]['meta_type'], constructors=(all_constructors[i], ), permission=ADD_CONTENT_PERMISSIONS[klassname])
def initialize(context): """initialize product (called by zope)""" ##code-section custom-init-top #fill in your manual code here from AccessControl import allow_module allow_module('Products.CompoundField.utils') ##/code-section custom-init-top # imports packages and types for registration import testClasses import CompoundField import CompoundWidget import ArrayField import ArrayWidget import EnhancedArrayWidget import ICompoundField import IArrayField # Initialize portal content all_content_types, all_constructors, all_ftis = process_types( listTypes(PROJECTNAME), PROJECTNAME) cmfutils.ContentInit( PROJECTNAME + ' Content', content_types = all_content_types, permission = DEFAULT_ADD_CONTENT_PERMISSION, extra_constructors = all_constructors, fti = all_ftis, ).initialize(context) # Give it some extra permissions to control them on a per class limit for i in range(0,len(all_content_types)): klassname=all_content_types[i].__name__ if not klassname in ADD_CONTENT_PERMISSIONS: continue context.registerClass(meta_type = all_ftis[i]['meta_type'], constructors= (all_constructors[i],), permission = ADD_CONTENT_PERMISSIONS[klassname])
def initialize(context): """initialize product (called by zope)""" ##code-section custom-init-top #fill in your manual code here from AccessControl import allow_module allow_module('Products.CompoundField.utils') ##/code-section custom-init-top # imports packages and types for registration import testClasses import CompoundField import CompoundWidget import ArrayField import ArrayWidget import EnhancedArrayWidget import ICompoundField import IArrayField # Initialize portal content all_content_types, all_constructors, all_ftis = process_types( listTypes(PROJECTNAME), PROJECTNAME) cmfutils.ContentInit( PROJECTNAME + ' Content', content_types=all_content_types, permission=DEFAULT_ADD_CONTENT_PERMISSION, extra_constructors=all_constructors, fti=all_ftis, ).initialize(context) # Give it some extra permissions to control them on a per class limit for i in range(0, len(all_content_types)): klassname = all_content_types[i].__name__ if not klassname in ADD_CONTENT_PERMISSIONS: continue context.registerClass(meta_type=all_ftis[i]['meta_type'], constructors=(all_constructors[i], ), permission=ADD_CONTENT_PERMISSIONS[klassname])
def initialize(context): """initialize product (called by zope)""" ##code-section custom-init-top #fill in your manual code here ##/code-section custom-init-top # imports packages and types for registration import EldisArticle from AccessControl import allow_module allow_module('Products.Eldis.Extensions.get_eldis_rss') #from AccessControl import ModuleSecurityInfo #ModuleSecurityInfo('from Products.Eldis.portal').declarePublic('getEldis_states') # Initialize portal content all_content_types, all_constructors, all_ftis = process_types( listTypes(PROJECTNAME), PROJECTNAME) cmfutils.ContentInit( PROJECTNAME + ' Content', content_types = all_content_types, permission = DEFAULT_ADD_CONTENT_PERMISSION, extra_constructors = all_constructors, fti = all_ftis, ).initialize(context) # Give it some extra permissions to control them on a per class limit for i in range(0,len(all_content_types)): klassname=all_content_types[i].__name__ if not klassname in ADD_CONTENT_PERMISSIONS: continue context.registerClass(meta_type = all_ftis[i]['meta_type'], constructors= (all_constructors[i],), permission = ADD_CONTENT_PERMISSIONS[klassname])
def initialize(context): """initialize product (called by zope)""" ##code-section custom-init-top #fill in your manual code here ##/code-section custom-init-top # imports packages and types for registration import EldisArticle from AccessControl import allow_module allow_module('Products.Eldis.Extensions.get_eldis_rss') #from AccessControl import ModuleSecurityInfo #ModuleSecurityInfo('from Products.Eldis.portal').declarePublic('getEldis_states') # Initialize portal content all_content_types, all_constructors, all_ftis = process_types( listTypes(PROJECTNAME), PROJECTNAME) cmfutils.ContentInit( PROJECTNAME + ' Content', content_types=all_content_types, permission=DEFAULT_ADD_CONTENT_PERMISSION, extra_constructors=all_constructors, fti=all_ftis, ).initialize(context) # Give it some extra permissions to control them on a per class limit for i in range(0, len(all_content_types)): klassname = all_content_types[i].__name__ if not klassname in ADD_CONTENT_PERMISSIONS: continue context.registerClass(meta_type=all_ftis[i]['meta_type'], constructors=(all_constructors[i], ), permission=ADD_CONTENT_PERMISSIONS[klassname])
def initialize(context): """Initializer called when used as a Zope 2 product.""" from AccessControl import allow_module allow_module('zope.component') allow_module('zope.event') allow_module("pdb") import TT.FischereiverbandNews.content # Initialize portal content all_content_types, all_constructors, all_ftis = process_types( listTypes(PROJECTNAME), PROJECTNAME) cmf_utils.ContentInit( PROJECTNAME + ' Content', content_types = all_content_types, permission = ADD_CONTENT_PERMISSION, extra_constructors = all_constructors, fti = all_ftis, ).initialize(context) print '> __init__ initialize TT.FischereiverbandNews success.'
from erp5.component.tool.ContributionTool import MAX_REPEAT from Products.ZSQLCatalog.SQLCatalog import Query, NegatedQuery from AccessControl import Unauthorized import zope.interface from AccessControl import allow_module, allow_class # Mixin Import from erp5.component.mixin.CachedConvertableMixin import CachedConvertableMixin from erp5.component.mixin.TextConvertableMixin import TextConvertableMixin from erp5.component.mixin.DownloadableMixin import DownloadableMixin from erp5.component.mixin.DocumentMixin import DocumentMixin from erp5.component.mixin.CrawlableMixin import CrawlableMixin from erp5.component.mixin.DiscoverableMixin import DiscoverableMixin from erp5.component.mixin.UrlMixin import UrlMixin allow_module(__name__) _MARKER = object() # these property ids are unchangable FIXED_PROPERTY_IDS = ('id', 'uid', 'rid', 'sid') # XXX: move to an easier to configure place (System Preference ?) VALID_TEXT_FORMAT_LIST = ('text', 'txt', 'html', 'base_html', 'stripped-html') VALID_IMAGE_FORMAT_LIST = ('jpg', 'jpeg', 'png', 'gif', 'pnm', 'ppm', 'tiff', 'svg') VALID_TRANSPARENT_IMAGE_FORMAT_LIST = ('png', 'gif', 'tiff', 'svg') DEFAULT_DISPLAY_ID_LIST = ( 'nano',
logger = logging.getLogger('Bika') from bika.lims.validators import * from bika.lims.config import * from bika.lims.permissions import * from AccessControl import ModuleSecurityInfo, allow_module from Products.Archetypes.atapi import process_types, listTypes from Products.CMFCore import utils from Products.CMFCore.DirectoryView import registerDirectory from Products.CMFCore.utils import ContentInit, ToolInit, getToolByName from Products.CMFPlone import PloneMessageFactory from Products.CMFPlone.interfaces import IPloneSiteRoot from Products.GenericSetup import EXTENSION, profile_registry allow_module('AccessControl') allow_module('bika.lims') allow_module('bika.lims.config') allow_module('bika.lims.permissions') allow_module('bika.lims.utils') allow_module('json') allow_module('pdb') allow_module('zope.i18n.locales') def initialize(context): from content.analysis import Analysis from content.analysiscategory import AnalysisCategory from content.analysisrequest import AnalysisRequest from content.analysisrequestquery import AnalysisRequestQuery from content.analysisrequestsfolder import AnalysisRequestsFolder
from zope.i18nmessageid import MessageFactory from Products.CMFCore.permissions import AddPortalContent PROJECTNAME = "bika.lims" # senaite message factory senaiteMessageFactory = MessageFactory("senaite.core") # BBB bikaMessageFactory = senaiteMessageFactory _ = senaiteMessageFactory # import this to log messages logger = logging.getLogger("senaite.core") # XXX: Do we really need all of these in templates? allow_module("AccessControl") allow_module("bika.lims") allow_module("bika.lims.config") allow_module("bika.lims.permissions") allow_module("bika.lims.utils") allow_module("json") allow_module("zope.i18n.locales") allow_module("zope.component") allow_module("plone.registry.interfaces") debug_mode = App.config.getConfiguration().debug_mode if debug_mode: allow_module("pdb") # Implicit module imports used by others # XXX Refactor these dependencies to explicit imports!
except ImportError: have_fss = 0 # do the minimal stuff for skin registering # note that CMF/Plone users will still have to run the # Extensions/Install.py script if have_cmf: # Need to do this in case Archetypes isn't present. from Products.CMFCore.FSFile import FSFile from Products.CMFCore.DirectoryView import registerFileExtension, registerDirectory registerFileExtension('xsl', FSFile) registerDirectory('common', globals()) if have_plone: from Products.kupu.plone import initialize elif have_zope2 and have_fss: import zope2 initialize = zope2.initialize if have_zope2: # in Zope 2, make all modules in the 'python' lib available def __allow_access_to_unprotected_subobjects__(name, value=None): return name in ('python') from AccessControl import allow_module allow_module('Products.kupu.python.nationalizer') allow_module('Products.kupu.python.spellcheck') # do nothing for zope3 (all is done in zcml)
from AccessControl import allow_module from Products.Archetypes.atapi import process_types, listTypes from Products.CMFCore import utils as plone_utils # Make senaite.health modules importable by through-the-web # https://docs.plone.org/develop/plone/security/sandboxing.html # https://docs.zope.org/zope2/zdgbook/Security.html # This allows Script python (e.g. guards from skins) to access to these modules. # To provide access to a module inside of a package, we need to provide security # declarations for all of the the packages and sub-packages along the path # used to access the module. Thus, all the modules from the path passed in to # `allow_module` will be available. # TODO Check if we really need to allow utils module allow_module('bika.health') allow_module('bika.health.utils') def initialize(context): from content.aetiologicagent import AetiologicAgent from content.caseoutcome import CaseOutcome from content.casestatus import CaseStatus from content.ethnicity import Ethnicity from content.casesyndromicclassification import CaseSyndromicClassification from content.disease import Disease from content.doctor import Doctor from content.doctors import Doctors from content.drug import Drug from content.drugprohibition import DrugProhibition
import Globals from Products.CMFCore.DirectoryView import registerDirectory from AccessControl import allow_module allow_module('Products.qSEOptimizer.util') qSEO_globals = globals() registerDirectory('skins', qSEO_globals)
def initialize(context): # Stuff has been moved from module level to this method for a # better separation of import and installation. # For the general user this change does not make a difference. # For test authors (and people who use parts of Plone only) # it does speed up import *significantly*. from AccessControl import ModuleSecurityInfo from AccessControl import allow_module, allow_class # protect OFS.ObjectManager ModuleSecurityInfo('OFS.ObjectManager').setDefaultAccess(0) ModuleSecurityInfo('OFS.ObjectManager').declareObjectPrivate() ModuleSecurityInfo('OFS.ObjectManager').declarePublic('BeforeDeleteException') # allow logging ModuleSecurityInfo('logging').declarePublic('getLogger') from logging import Logger allow_class(Logger) # various small utils functions # added for unescaping view names in urls when finding selected action ModuleSecurityInfo('urllib').declarePublic('unquote') allow_module('Products.CMFPlone.utils') # For content_status_modify from Products.CMFCore.WorkflowCore import ObjectMoved, ObjectDeleted, \ WorkflowException ModuleSecurityInfo('Products.CMFCore.WorkflowCore') \ .declarePublic('ObjectMoved') ModuleSecurityInfo('Products.CMFCore.WorkflowCore') \ .declarePublic('ObjectDeleted') ModuleSecurityInfo('Products.CMFCore.WorkflowCore') \ .declarePublic('WorkflowException') allow_class(ObjectMoved) allow_class(ObjectDeleted) allow_class(WorkflowException) from PloneBatch import Batch allow_class(Batch) # Make Batch available at module level this_module.Batch = Batch ModuleSecurityInfo('StringIO').declarePublic('StringIO') from StringIO import StringIO allow_class(StringIO) # Make Unauthorized importable TTW ModuleSecurityInfo('AccessControl').declarePublic('Unauthorized') # Make Forbidden importable TTW ModuleSecurityInfo('zExceptions').declarePublic('Forbidden') # Make ConflictError importable TTW ModuleSecurityInfo('ZODB.POSException').declarePublic('ConflictError') # Make ZCTextIndex ParseError importable TTW ModuleSecurityInfo('Products.ZCTextIndex.ParseTree') \ .declarePublic('ParseError') # Make DateTimeError importable TTW ModuleSecurityInfo('DateTime.interfaces').declarePublic('DateTimeError') ModuleSecurityInfo('DateTime.interfaces').declarePublic('SyntaxError') # BBB support for DateTime < 3 ModuleSecurityInfo('DateTime.DateTime').declarePublic('DateTimeError') ModuleSecurityInfo('DateTime.DateTime').declarePublic('SyntaxError') # Make CopyError importable TTW ModuleSecurityInfo('OFS.CopySupport').declarePublic('CopyError') # Make AllowSendto importable TTW ModuleSecurityInfo('Products.CMFPlone.PloneTool') \ .declarePublic('AllowSendto') # Make ZCatalog's mergeResults importable TTW ModuleSecurityInfo('Products.ZCatalog.Catalog') \ .declarePublic('mergeResults') # Make the navtree constructs available TTW allow_module('Products.CMFPlone.browser.navtree') # Allow access to the exception in the folder_delete script from OFS.ObjectManager import BeforeDeleteException allow_module('OFS.ObjectManager') allow_class(BeforeDeleteException) # Make cgi.escape available TTW ModuleSecurityInfo('cgi').declarePublic('escape') # Apply monkey patches import patches # Register unicode splitter w/ ZCTextIndex # pipeline registry import UnicodeSplitter # Plone content # Usage of PloneFolder is discouraged. import PloneFolder contentClasses = (PloneFolder.PloneFolder, ) contentConstructors = (PloneFolder.addPloneFolder, ) # CMFCore and CMFDefault tools from Products.CMFCore import CachingPolicyManager # Plone tools import PloneTool import FactoryTool import MigrationTool import PloneControlPanel import WorkflowTool import URLTool import MetadataTool import RegistrationTool import PropertiesTool import ActionsTool import TypesTool import CatalogTool import SkinsTool import CalendarTool import QuickInstallerTool import TranslationServiceTool tools = (PloneTool.PloneTool, WorkflowTool.WorkflowTool, CachingPolicyManager.CachingPolicyManager, FactoryTool.FactoryTool, PropertiesTool.PropertiesTool, MigrationTool.MigrationTool, PloneControlPanel.PloneControlPanel, RegistrationTool.RegistrationTool, URLTool.URLTool, MetadataTool.MetadataTool, ActionsTool.ActionsTool, TypesTool.TypesTool, CatalogTool.CatalogTool, SkinsTool.SkinsTool, CalendarTool.CalendarTool, QuickInstallerTool.QuickInstallerTool, TranslationServiceTool.TranslationServiceTool, ) from Products.CMFCore.utils import ContentInit from Products.CMFPlone.utils import ToolInit # Register tools and content ToolInit('Plone Tool', tools=tools, icon='tool.gif', ).initialize(context) ContentInit('Plone Content', content_types=contentClasses, permission=ADD_CONTENT_PERMISSION, extra_constructors=contentConstructors, ).initialize(context) from Products.CMFPlone.Portal import PloneSite from Products.CMFPlone.factory import zmi_constructor from AccessControl.Permissions import view_management_screens context.registerClass( instance_class=PloneSite, permission=view_management_screens, constructors=(zmi_constructor, ), ) from plone.app.folder import nogopip context.registerClass(nogopip.GopipIndex, permission='Add Pluggable Index', constructors=(nogopip.manage_addGopipForm, nogopip.manage_addGopipIndex), icon='index.gif', visibility=None)
# -*- coding: utf-8 -*- from AccessControl import allow_module from AccessControl.Permissions import add_user_folders from Products.PluggableAuthService.PluggableAuthService import registerMultiPlugin # noqa from plone.restapi.pas import plugin import pkg_resources allow_module('json') try: pkg_resources.get_distribution('plone.app.testing') REGISTER_TEST_TYPES = True except pkg_resources.DistributionNotFound: # pragma: no cover REGISTER_TEST_TYPES = False try: pkg_resources.get_distribution('plone.app.contenttypes') HAS_PLONE_APP_CONTENTTYPES = True except pkg_resources.DistributionNotFound: # pragma: no cover HAS_PLONE_APP_CONTENTTYPES = False def initialize(context): registerMultiPlugin(plugin.JWTAuthenticationPlugin.meta_type) context.registerClass( plugin.JWTAuthenticationPlugin, permission=add_user_folders, constructors=(plugin.manage_addJWTAuthenticationPlugin, plugin.addJWTAuthenticationPlugin), visibility=None,
# make sure, 'from Interface import Interface' will work... try: from Interface import Interface except ImportError: # Zope <2.6 import Interface Interface.Interface = Interface.Base # make sure 'from AccessControl import allow_module' works... try: from AccessControl import allow_module except ImportError: # Zope <2.5 from AccessControl import ModuleSecurityInfo def allow_module(module_name): ModuleSecurityInfo(module_name).setDefaultAccess(1) dot = module_name.find('.') while dot > 0: ModuleSecurityInfo(module_name[:dot]).setDefaultAccess(1) dot = module_name.find('.', dot + 1) __allow_access_to_unprotected_subobjects__ = 1 __roles__ = None # make ZopeTree module accessible from PythonScript and ZPT from ZopeTree import ZopeTree, Node # noqa from TreeObjectWrapper import TreeObjectWrapper # noqa allow_module('Products.ZopeTree')
cp_id = 'TranslationService' # module level translation service translation_service = None # icon misc_ = { 'PlacelessTranslationService.png': Globals.ImageFile('www/PlacelessTranslationService.png', globals()), 'GettextMessageCatalog.png': Globals.ImageFile('www/GettextMessageCatalog.png', globals()), } # set product-wide attrs for importing security = ModuleSecurityInfo('Products.PlacelessTranslationService') allow_module('Products.PlacelessTranslationService') security.declareProtected(view, 'getTranslationService') def getTranslationService(): """returns the PTS instance """ return translation_service security.declareProtected(view, 'translate') @deprecate("The translate method of the PTS package is deprecated and will be " "removed in the next PTS release. Use the translate method of the " "global translation service instead.") def translate(*args, **kwargs): """see PlaceslessTranslationService.PlaceslessTranslationService """ return getTranslationService().translate(*args, **kwargs)
logger = logging.getLogger('Bika') from bika.lims.validators import * from bika.lims.config import * from bika.lims.permissions import * from AccessControl import ModuleSecurityInfo, allow_module from Products.Archetypes.atapi import process_types, listTypes from Products.CMFCore import utils from Products.CMFCore.DirectoryView import registerDirectory from Products.CMFCore.utils import ContentInit, ToolInit, getToolByName from Products.CMFPlone import PloneMessageFactory from Products.CMFPlone.interfaces import IPloneSiteRoot from Products.GenericSetup import EXTENSION, profile_registry allow_module('AccessControl') allow_module('bika.lims') allow_module('bika.lims.config') allow_module('bika.lims.permissions') allow_module('bika.lims.utils') allow_module('json') allow_module('zope.i18n.locales') allow_module('zope.component') allow_module('plone.registry.interfaces') import App debug_mode = App.config.getConfiguration().debug_mode if debug_mode: allow_module('pdb') allow_module('pudb')
from AccessControl import allow_module from zope.i18nmessageid import MessageFactory SeoptimizerMessageFactory = MessageFactory('quintagroup.seoptimizer') allow_module('quintagroup.seoptimizer.util')
from bika.lims import interfaces from bika.lims import logger from bika.lims.config import POINTS_OF_CAPTURE from email.Utils import formataddr from plone.i18n.normalizer.interfaces import IIDNormalizer from reportlab.graphics.barcode import getCodes, getCodeNames, createBarcodeDrawing from zope.component import getUtility from zope.interface import providedBy from magnitude import mg, MagnitudeError import copy,re,urllib import json import plone.protect import transaction ModuleSecurityInfo('email.Utils').declarePublic('formataddr') allow_module('csv') # Wrapper for PortalTransport's sendmail - don't know why there sendmail # method is marked private ModuleSecurityInfo('Products.bika.utils').declarePublic('sendmail') #Protected( Publish, 'sendmail') def sendmail(portal, from_addr, to_addrs, msg): mailspool = portal.portal_mailspool mailspool.sendmail(from_addr, to_addrs, msg) class js_log(BrowserView): def __call__(self, message): """Javascript sends a string for us to place into the log. """ self.logger.info(message)
from AccessControl import allow_module allow_module('uccswebcouturier.dropdownmenu.utils') def initialize(context): """Initializer called when used as a Zope 2 product."""
ContainerAssertions[OrderedDict] = _check_access_wrapper( OrderedDict, _dict_white_list) OrderedDict.__guarded_setitem__ = OrderedDict.__setitem__.__func__ OrderedDict.__guarded_delitem__ = OrderedDict.__delitem__.__func__ _counter_white_list = copy.copy(_dict_white_list) _counter_white_list['most_common'] = 1 ContainerAssertions[Counter] = _check_access_wrapper(Counter, _counter_white_list) Counter.__guarded_setitem__ = dict.__setitem__ Counter.__guarded_delitem__ = dict.__delitem__ ModuleSecurityInfo('collections').declarePublic('namedtuple') # given as example in Products.PythonScripts.module_access_examples allow_module('base64') allow_module('binascii') allow_module('bisect') allow_module('colorsys') allow_module('crypt') ## allow_module('pprint') allow_module('quopri') ModuleSecurityInfo('json').declarePublic('dumps', 'loads') import re allow_module('fnmatch') allow_module('re') allow_type(type(re.compile('')))
# -*- coding: utf-8 -*- from AccessControl import allow_module from AccessControl.Permissions import add_user_folders from Products.PluggableAuthService.PluggableAuthService import registerMultiPlugin from plone.restapi.pas import plugin import pkg_resources allow_module("json") try: pkg_resources.get_distribution("plone.app.testing") except pkg_resources.DistributionNotFound: REGISTER_TEST_TYPES = False else: REGISTER_TEST_TYPES = True try: pkg_resources.get_distribution("plone.app.contenttypes") except pkg_resources.DistributionNotFound: HAS_PLONE_APP_CONTENTTYPES = False else: HAS_PLONE_APP_CONTENTTYPES = True def initialize(context): registerMultiPlugin(plugin.JWTAuthenticationPlugin.meta_type) context.registerClass( plugin.JWTAuthenticationPlugin, permission=add_user_folders,
def initialize(context): # Stuff has been moved from module level to this method for a # better separation of import and installation. # For the general user this change does not make a difference. # For test authors (and people who use parts of Plone only) # it does speed up import *significantly*. from AccessControl import ModuleSecurityInfo from AccessControl import allow_class from AccessControl import allow_module from AccessControl import allow_type # protect OFS.ObjectManager ModuleSecurityInfo('OFS.ObjectManager').setDefaultAccess(0) ModuleSecurityInfo('OFS.ObjectManager').declareObjectPrivate() ModuleSecurityInfo('OFS.ObjectManager').declarePublic( 'BeforeDeleteException') # allow logging ModuleSecurityInfo('logging').declarePublic('getLogger') from logging import Logger allow_class(Logger) # various small utils functions # added for unescaping view names in urls when finding selected action ModuleSecurityInfo('urllib').declarePublic('unquote') allow_module('Products.CMFPlone.utils') # For content_status_modify from Products.CMFCore.WorkflowCore import ObjectDeleted from Products.CMFCore.WorkflowCore import ObjectMoved from Products.CMFCore.WorkflowCore import WorkflowException ModuleSecurityInfo( 'Products.CMFCore.WorkflowCore').declarePublic('ObjectDeleted') ModuleSecurityInfo( 'Products.CMFCore.WorkflowCore').declarePublic('ObjectMoved') ModuleSecurityInfo( 'Products.CMFCore.WorkflowCore').declarePublic('WorkflowException') allow_class(ObjectDeleted) allow_class(ObjectMoved) allow_class(WorkflowException) from Products.CMFPlone.PloneBatch import Batch allow_class(Batch) # Make Batch available at module level this_module.Batch = Batch ModuleSecurityInfo('StringIO').declarePublic('StringIO') from six import StringIO allow_class(StringIO) # Make Unauthorized importable TTW ModuleSecurityInfo('AccessControl').declarePublic('Unauthorized') # Make Forbidden importable TTW ModuleSecurityInfo('zExceptions').declarePublic('Forbidden') # Make ConflictError importable TTW ModuleSecurityInfo('ZODB.POSException').declarePublic('ConflictError') # Make ZCTextIndex ParseError importable TTW ModuleSecurityInfo('Products.ZCTextIndex.ParseTree') \ .declarePublic('ParseError') # Make DateTimeError importable TTW ModuleSecurityInfo('DateTime.interfaces').declarePublic('DateTimeError') ModuleSecurityInfo('DateTime.interfaces').declarePublic('SyntaxError') # BBB support for DateTime < 3 ModuleSecurityInfo('DateTime.DateTime').declarePublic('DateTimeError') ModuleSecurityInfo('DateTime.DateTime').declarePublic('SyntaxError') # Make CopyError importable TTW ModuleSecurityInfo('OFS.CopySupport').declarePublic('CopyError') # Make AllowSendto importable TTW ModuleSecurityInfo('Products.CMFPlone.PloneTool') \ .declarePublic('AllowSendto') # Make ZCatalog's mergeResults importable TTW ModuleSecurityInfo('Products.ZCatalog.Catalog') \ .declarePublic('mergeResults') # Make the navtree constructs available TTW allow_module('Products.CMFPlone.browser.navtree') # Allow access to the exception in the folder_delete script from OFS.ObjectManager import BeforeDeleteException allow_module('OFS.ObjectManager') allow_class(BeforeDeleteException) # Make cgi.escape available TTW ModuleSecurityInfo('cgi').declarePublic('escape') # We want to allow all methods on string type except 'format'. # That one needs special handling to avoid access to attributes. from Products.CMFPlone.utils import _safe_format rules = dict([(m, True) for m in dir(str) if not m.startswith('_')]) rules['format'] = _safe_format allow_type(str, rules) # Same for unicode instead of str. rules = dict([(m, True) for m in dir(unicode) if not m.startswith('_')]) rules['format'] = _safe_format allow_type(unicode, rules) # Apply monkey patches from Products.CMFPlone import patches # noqa # Register unicode splitter w/ ZCTextIndex # pipeline registry from Products.CMFPlone import UnicodeSplitter # noqa # Plone content # Usage of PloneFolder is discouraged. from Products.CMFPlone import PloneFolder contentClasses = (PloneFolder.PloneFolder, ) contentConstructors = (PloneFolder.addPloneFolder, ) # CMFCore tools from Products.CMFCore import CachingPolicyManager # Plone tools from Products.CMFPlone import PloneTool from Products.CMFPlone import MigrationTool from Products.CMFPlone import PloneControlPanel from Products.CMFPlone import WorkflowTool from Products.CMFPlone import URLTool from Products.CMFPlone import RegistrationTool from Products.CMFPlone import PropertiesTool from Products.CMFPlone import ActionsTool from Products.CMFPlone import TypesTool from Products.CMFPlone import CatalogTool from Products.CMFPlone import SkinsTool from Products.CMFPlone import QuickInstallerTool from Products.CMFPlone import TranslationServiceTool tools = ( PloneTool.PloneTool, WorkflowTool.WorkflowTool, CachingPolicyManager.CachingPolicyManager, PropertiesTool.PropertiesTool, MigrationTool.MigrationTool, PloneControlPanel.PloneControlPanel, RegistrationTool.RegistrationTool, URLTool.URLTool, ActionsTool.ActionsTool, TypesTool.TypesTool, CatalogTool.CatalogTool, SkinsTool.SkinsTool, QuickInstallerTool.QuickInstallerTool, TranslationServiceTool.TranslationServiceTool, ) from Products.CMFCore.utils import ContentInit from Products.CMFPlone.utils import ToolInit # Register tools and content ToolInit( 'Plone Tool', tools=tools, icon='tool.gif', ).initialize(context) ContentInit( 'Plone Content', content_types=contentClasses, permission=ADD_CONTENT_PERMISSION, extra_constructors=contentConstructors, ).initialize(context) from AccessControl.Permissions import view_management_screens from Products.CMFPlone.Portal import PloneSite from Products.CMFPlone.factory import zmi_constructor context.registerClass( instance_class=PloneSite, permission=view_management_screens, constructors=(zmi_constructor, ), ) from plone.app.folder import nogopip context.registerClass( nogopip.GopipIndex, permission='Add Pluggable Index', constructors=(nogopip.manage_addGopipForm, nogopip.manage_addGopipIndex), icon='index.gif', visibility=None )
"""Main product initializer """ from zope.i18nmessageid import MessageFactory from bungenicms.workspaces import config from Products.Archetypes import atapi from Products.CMFCore import utils from AccessControl import allow_module allow_module('bungenicms.workspaces.content.principal_content') def initialize(context): """Initializer called when used as a Zope 2 product. This is referenced from configure.zcml. Regstrations as a "Zope 2 product" is necessary for GenericSetup profiles to work, for example. Here, we call the Archetypes machinery to register our content types with Zope and the CMF. """ # Retrieve the content types that have been registered with Archetypes # This happens when the content type is imported and the registerType() # call in the content type's module is invoked. Actually, this happens # during ZCML processing, but we do it here again to be explicit. Of # course, even if we import the module several times, it is only run # once. content_types, constructors, ftis = atapi.process_types(
# -*- coding: utf-8 -*- """Init and utils.""" from zope.i18nmessageid import MessageFactory from AccessControl import allow_module _ = MessageFactory('plomino.printdocuments') allow_module("plomino.printdocuments.serialdoc")
def initialize(context): """Initializer called when used as a Zope 2 product.""" from AccessControl import allow_module allow_module('slc.linguatools')
from AccessControl import allow_module # Feed our monkeys :-) from quintagroup.plonecomments import patch allow_module('quintagroup.plonecomments.utils')
profile_registry.registerProfile('rhaptos-default', 'RhaptosSite', 'Extension profile for a RhaptosSite', 'profiles/default', 'RhaptosSite', EXTENSION, for_=IPloneSiteRoot) context.registerClass( AHA.AltHashAuth , permission=ManageUsers , constructors=( AHA.manage_addAltHashAuthForm, AHA.addAltHashAuth, ) , visibility=None , icon='pas/www/altauth.png' ) # Import "RhaptosMessageFactory as _" to create message ids in the rhaptos domain # Zope 3.1-style messagefactory module # BBB: Zope 2.8 / Zope X3.0 allow_module('Products.RhaptosSite.messagefactory_') try: from zope.i18nmessageid import MessageFactory except ImportError: from messagefactory_ import RhaptosMessageFactory else: RhaptosMessageFactory = MessageFactory('rhaptos')
# -*- coding: utf-8 -*- from AccessControl import allow_module from AccessControl.Permissions import add_user_folders from plone.restapi.pas import plugin from Products.PluggableAuthService.PluggableAuthService import ( registerMultiPlugin, ) from zope.i18nmessageid import MessageFactory import pkg_resources _ = MessageFactory("plone.restapi") PROJECT_NAME = "plone.restapi" allow_module("json") try: pkg_resources.get_distribution("plone.app.testing") REGISTER_TEST_TYPES = True except pkg_resources.DistributionNotFound: # pragma: no cover REGISTER_TEST_TYPES = False try: pkg_resources.get_distribution("plone.app.contenttypes") HAS_PLONE_APP_CONTENTTYPES = True except pkg_resources.DistributionNotFound: # pragma: no cover HAS_PLONE_APP_CONTENTTYPES = False try: pkg_resources.get_distribution("Products.Archetypes") except pkg_resources.DistributionNotFound: HAS_AT = False
from AccessControl.ZopeGuards import _dict_white_list # Attributes cannot be set on defaultdict, thus modify 'safetype' dict # (closure) directly to ignore defaultdict like dict/list from RestrictedPython.Guards import full_write_guard ContainerAssertions[defaultdict] = _check_access_wrapper(defaultdict, _dict_white_list) full_write_guard.func_closure[1].cell_contents.__self__[defaultdict] = True # In contrary to builtins such as dict/defaultdict, it is possible to set # attributes on OrderedDict instances, so only allow setitem/delitem ContainerAssertions[OrderedDict] = _check_access_wrapper(OrderedDict, _dict_white_list) OrderedDict.__guarded_setitem__ = OrderedDict.__setitem__.__func__ OrderedDict.__guarded_delitem__ = OrderedDict.__delitem__.__func__ # given as example in Products.PythonScripts.module_access_examples allow_module('base64') allow_module('binascii') allow_module('bisect') allow_module('colorsys') allow_module('crypt') ## allow_module('pprint') allow_module('quopri') ModuleSecurityInfo('json').declarePublic('dumps', 'loads') import re allow_module('fnmatch') allow_module('re') allow_type(type(re.compile(''))) allow_type(type(re.match('x','x')))
from AccessControl import allow_module from Products.CMFCore.DirectoryView import registerDirectory, registerFileExtension from config import GLOBALS allow_module('Products.qRSS2Syndication.utils.py') PROJECTNAME = "qRSS2Syndication" SKINS_DIR = 'skins' registerDirectory(SKINS_DIR, GLOBALS)
""" isort:skip """ # # ZopeTree # # Copyright (c) 2001-2003 by Philipp "philiKON" von Weitershausen # # This software is distributed under the terms of the Mozilla Public License # (MPL) # from AccessControl import allow_module __allow_access_to_unprotected_subobjects__ = 1 __roles__ = None from Products.ZopeTree.TreeObjectWrapper import TreeObjectWrapper # noqa # make ZopeTree module accessible from PythonScript and ZPT from Products.ZopeTree.ZopeTree import Node, ZopeTree # noqa # isort:skip allow_module("Products.ZopeTree")
if getattr(value, '__name__', None) != name: return 0 return _set_white_get(name, 0) ContainerAssertions[set] = _check_set_access ContainerAssertions[frozenset] = 1 from collections import OrderedDict OrderedDict.__allow_access_to_unprotected_subobjects__ = 1 from AccessControl import allow_module, allow_class, allow_type from AccessControl import ModuleSecurityInfo # given as example in Products.PythonScripts.module_access_examples allow_module('base64') allow_module('binascii') allow_module('bisect') allow_module('colorsys') allow_module('crypt') ## allow_module('pprint') ModuleSecurityInfo('json').declarePublic('dumps', 'loads') import re allow_module('fnmatch') allow_module('re') allow_type(type(re.compile(''))) allow_type(type(re.match('x','x')))
xwfutils_security.declarePublic('add_marker_interfaces') xwfutils_security.declarePublic('remove_marker_interfaces') xwfutils_security.declarePublic('sort_by_name') xwfutils_security.declarePublic('comma_comma_and') xwfutils_security.declarePublic('timedelta_to_string') xwfutils_security.declarePublic('deprecated') xwfutils_security.declarePublic('format_exec') xwfutils_security.declarePublic('object_values') csv_security = ModuleSecurityInfo('Products.XWFCore.CSV') csv_security.declarePublic('CSVFile') from Products.XWFCore.CSV import CSVFile allow_class(CSVFile) def initialize(context): # Import lazily, and defer initialization to the module import XWFCatalog XWFCatalog.initialize(context) validator_security = ModuleSecurityInfo('Products.XWFCore.validators') validator_security.declarePublic('validate_email') validator_security.declarePublic('ValidationError') from odict import ODict # lint:ok from AccessControl import allow_module allow_module('traceback')
""" Rhaptos Initialization Author: J Cameron Cooper (C) 2006 Rice University This software is subject to the provisions of the GNU General Public License Version 2 (GPL). See LICENSE.txt for details. """ ## allow imports in restricted code from AccessControl import allow_module, allow_class, allow_type from AccessControl import ModuleSecurityInfo from AccessControl.Permissions import search_zcatalog as SearchZCatalog # needed for validate_portrait allow_module('mimetypes') allow_module('Products.RhaptosSite.managercatalog') ModuleSecurityInfo('Products.RhaptosSite.managercatalog').declareProtected( SearchZCatalog, 'workspacesSearchResults')
from plone.memoize import ram from plone.registry.interfaces import IRegistry from Products.Archetypes.public import DisplayList from Products.CMFCore.utils import getToolByName from Products.CMFPlone.utils import safe_unicode from zope.component import queryUtility from zope.i18n import translate from zope.i18n.locales import locales import App import Globals import os import re import urllib2 ModuleSecurityInfo('email.Utils').declarePublic('formataddr') allow_module('csv') def to_utf8(text): if text is None: text = '' return safe_unicode(text).encode('utf-8') def to_unicode(text): if text is None: text = '' return safe_unicode(text) def t(i18n_msg):
else: mt = MailTemplate(id, file, headers.get('content_type')) self._setObject(id, mt) ob = getattr(self, id) if mailhost: ob._setPropValue('mailhost', mailhost) if submit == " Add and Edit ": u = ob.absolute_url() else: u = ob.aq_parent.absolute_url() REQUEST.RESPONSE.redirect(u + '/manage_main') # allow all the email module's public bits import email for name in email.__all__: path = 'email.' + name allow_module(path) try: mod = __import__(path) except ImportError: pass else: mod = getattr(mod, name) for mod_name in dir(mod): obj = getattr(mod, mod_name) if isinstance(obj, ClassType): allow_class(obj)
from Products.CMFCore.permissions import AddPortalContent from Products.CMFCore.utils import ContentInit from zope.i18nmessageid import MessageFactory PRODUCT_NAME = "senaite.storage" PROFILE_ID = "profile-{}:default".format(PRODUCT_NAME) # Make senaite.storage modules importable by through-the-web # https://docs.plone.org/develop/plone/security/sandboxing.html # https://docs.zope.org/zope2/zdgbook/Security.html # This allows Script python (e.g. guards from skins) to access to these modules. # To provide access to a module inside of a package, we need to provide security # declarations for all of the the packages and sub-packages along the path # used to access the module. Thus, all the modules from the path passed in to # `allow_module` will be available. allow_module('senaite.storage.workflow.samplescontainer.guards') # Defining a Message Factory for when this product is internationalized. senaiteMessageFactory = MessageFactory(PRODUCT_NAME) logger = logging.getLogger(PRODUCT_NAME) def initialize(context): """Initializer called when used as a Zope 2 product.""" logger.info("*** Initializing SENAITE.STORAGE ***") from .content.storagerootfolder import StorageRootFolder from .content.storagecontainer import StorageContainer from .content.storagefacility import StorageFacility from .content.storagesamplescontainer import StorageSamplesContainer
from Products.CMFPlone.utils import base_hasattr from plone.portlets.interfaces import IPortletManager from plone.portlets.interfaces import IPortletAssignmentMapping, ILocalPortletAssignmentManager from plone.portlet.collection.collection import Assignment from plone.registry import field as Field from plone.registry import Record from plone.registry.interfaces import IRegistry from plone.app.discussion.interfaces import ICommentingTool from plone.app.discussion.interfaces import IConversation from collective.transcode.star.interfaces import ITranscodeTool from plumi.app.translations import createTranslations, deleteTranslations allow_module('plumi.app.member_area.py') _ = MessageFactory("plumi") def app_installation_tasks(self, reinstall=False): """Custom Plumi setup code""" logger=logging.getLogger('plumi.app') logger.info('starting app_installation_tasks. self is %s' %self) portal=getToolByName(self,'portal_url').getPortalObject() setupRSS(portal, logger) setupCollections(portal, logger) def publishObject(wftool,obj): logger=logging.getLogger('plumi.app') try: