Exemplo n.º 1
0
    def setUpZope(self, app, configurationContext):
        for locales in self._get_robot_variable('REGISTER_TRANSLATIONS'):
            if locales and os.path.isdir(locales):
                from zope.i18n.zcml import registerTranslations
                registerTranslations(configurationContext, locales)

        for name in self._get_robot_variable('META_PACKAGES'):
            if not name in sys.modules:
                __import__(name)
            package = sys.modules[name]
            xmlconfig.file('meta.zcml', package, context=configurationContext)

        for name in self._get_robot_variable('CONFIGURE_PACKAGES'):
            if not name in sys.modules:
                __import__(name)
            package = sys.modules[name]
            xmlconfig.file('configure.zcml',
                           package,
                           context=configurationContext)

        for name in self._get_robot_variable('OVERRIDE_PACKAGES'):
            if not name in sys.modules:
                __import__(name)
            package = sys.modules[name]
            xmlconfig.includeOverrides(configurationContext,
                                       'overrides.zcml',
                                       package=package)

        for name in self._get_robot_variable('INSTALL_PRODUCTS'):
            if not name in sys.modules:
                __import__(name)
            z2.installProduct(app, name)
Exemplo n.º 2
0
    def setUpZope(self, app, configurationContext):

        for name in self._get_robot_variable('META_PACKAGES'):
            if not name in sys.modules:
                __import__(name)
            package = sys.modules[name]
            xmlconfig.file('meta.zcml', package,
                           context=configurationContext)

        for name in self._get_robot_variable('CONFIGURE_PACKAGES'):
            if not name in sys.modules:
                __import__(name)
            package = sys.modules[name]
            xmlconfig.file('configure.zcml', package,
                           context=configurationContext)

        for name in self._get_robot_variable('OVERRIDE_PACKAGES'):
            if not name in sys.modules:
                __import__(name)
            package = sys.modules[name]
            xmlconfig.includeOverrides(
                configurationContext, 'overrides.zcml', package=package)

        for name in self._get_robot_variable('INSTALL_PRODUCTS'):
            if not name in sys.modules:
                __import__(name)
            z2.installProduct(app, name)
Exemplo n.º 3
0
    def setUpZope(self, app, configurationContext):
        for locales in self._get_robot_variable('REGISTER_TRANSLATIONS'):
            if locales and os.path.isdir(locales):
                from zope.i18n.zcml import registerTranslations
                registerTranslations(configurationContext, locales)

        for name in self._get_robot_variable('META_PACKAGES'):
            if not name in sys.modules:
                __import__(name)
            package = sys.modules[name]
            xmlconfig.file('meta.zcml', package,
                           context=configurationContext)

        for name in self._get_robot_variable('CONFIGURE_PACKAGES'):
            if not name in sys.modules:
                __import__(name)
            package = sys.modules[name]
            xmlconfig.file('configure.zcml', package,
                           context=configurationContext)

        for name in self._get_robot_variable('OVERRIDE_PACKAGES'):
            if not name in sys.modules:
                __import__(name)
            package = sys.modules[name]
            xmlconfig.includeOverrides(
                configurationContext, 'overrides.zcml', package=package)

        for name in self._get_robot_variable('INSTALL_PRODUCTS'):
            if not name in sys.modules:
                __import__(name)
            z2.installProduct(app, name)
Exemplo n.º 4
0
    def setUpZope(self, app, configurationContext):

        for name in self._get_robot_variable('META_PACKAGES'):
            if not name in sys.modules:
                __import__(name)
            package = sys.modules[name]
            xmlconfig.file('meta.zcml', package, context=configurationContext)

        for name in self._get_robot_variable('CONFIGURE_PACKAGES'):
            if not name in sys.modules:
                __import__(name)
            package = sys.modules[name]
            xmlconfig.file('configure.zcml',
                           package,
                           context=configurationContext)

        for name in self._get_robot_variable('OVERRIDE_PACKAGES'):
            if not name in sys.modules:
                __import__(name)
            package = sys.modules[name]
            xmlconfig.includeOverrides(configurationContext,
                                       'overrides.zcml',
                                       package=package)

        for name in self._get_robot_variable('INSTALL_PRODUCTS'):
            if not name in sys.modules:
                __import__(name)
            z2.installProduct(app, name)
Exemplo n.º 5
0
    def setUpZope(self, app, configurationContext):
        # Load ZCML
        xmlconfig.file('configure.zcml',
                       ploneintranet.workspace,
                       context=configurationContext)
        xmlconfig.includeOverrides(
            configurationContext,
            'overrides.zcml',
            package=ploneintranet.workspace,
        )

        xmlconfig.file('configure.zcml',
                       collective.workspace,
                       context=configurationContext)

        xmlconfig.file('configure.zcml',
                       ploneintranet.microblog,
                       context=configurationContext)

        xmlconfig.file('configure.zcml',
                       ploneintranet.activitystream,
                       context=configurationContext)

        xmlconfig.file('configure.zcml',
                       ploneintranet.invitations,
                       context=configurationContext)

        xmlconfig.file('configure.zcml',
                       Products.CMFPlacefulWorkflow,
                       context=configurationContext)

        xmlconfig.file('configure.zcml',
                       ploneintranet.layout,
                       context=configurationContext)

        xmlconfig.file('configure.zcml',
                       ploneintranet.network,
                       context=configurationContext)

        xmlconfig.file('configure.zcml',
                       ploneintranet.theme,
                       context=configurationContext)

        xmlconfig.file('configure.zcml',
                       ploneintranet.todo,
                       context=configurationContext)

        xmlconfig.file('configure.zcml',
                       ploneintranet.search,
                       context=configurationContext)

        xmlconfig.file('configure.zcml',
                       ploneintranet.docconv.client,
                       context=configurationContext)

        # Install products that use an old-style initialize() function
        z2.installProduct(app, 'collective.workspace')
        z2.installProduct(app, 'Products.CMFPlacefulWorkflow')
Exemplo n.º 6
0
def loadProductsOverrides(_context):
    for product in findProducts():
        zcml = os.path.join(os.path.dirname(product.__file__),
                            'overrides.zcml')
        if os.path.isfile(zcml):
            try:
                xmlconfig.includeOverrides(_context, zcml, package=product)
            except: # Yes, really, *any* kind of error.
                handleBrokenProduct(product)
Exemplo n.º 7
0
 def setUpZope(self, app, configurationContext):
     """Set up Zope."""
     # Load ZCML
     self.loadZCML(package=imio.urban.core, name='testing.zcml')
     xmlconfig.includeOverrides(configurationContext,
                                'overrides.zcml',
                                package=imio.urban.core)
     for p in self.products:
         z2.installProduct(app, p)
Exemplo n.º 8
0
def loadProductsOverrides(_context):
    for product in findProducts():
        zcml = os.path.join(os.path.dirname(product.__file__),
                            'overrides.zcml')
        if os.path.isfile(zcml):
            try:
                xmlconfig.includeOverrides(_context, zcml, package=product)
            except:  # Yes, really, *any* kind of error.
                handleBrokenProduct(product)
Exemplo n.º 9
0
def load_config_override(file, package=None, execute=True):
    """Load an additional ZCML file into the context, overriding others.

    Use with extreme care.
    """
    from zope.configuration import xmlconfig
    from Products.Five.zcml import _context
    xmlconfig.includeOverrides(_context, file, package=package)
    if execute:
        _context.execute_actions()
Exemplo n.º 10
0
def includeZCMLGroup(_context, info, filename, override=False):
    includable_zcml = info[filename]

    zcml_context = repr(_context.info)

    for dotted_name in includable_zcml:
        includable_package = resolve(dotted_name)
        if override:
            includeOverrides(_context, filename, includable_package)
        else:
            include(_context, filename, includable_package)
Exemplo n.º 11
0
    def setUpZope(self, app, configurationContext):
        # Load ZCML
        xmlconfig.file(
            'configure.zcml',
            ploneintranet.workspace,
            context=configurationContext
        )
        xmlconfig.includeOverrides(
            configurationContext,
            'overrides.zcml',
            package=ploneintranet.workspace,
        )

        xmlconfig.file(
            'configure.zcml',
            collective.workspace,
            context=configurationContext
        )

        xmlconfig.file(
            'configure.zcml',
            ploneintranet.microblog,
            context=configurationContext
        )

        xmlconfig.file(
            'configure.zcml',
            ploneintranet.activitystream,
            context=configurationContext
        )

        xmlconfig.file(
            'configure.zcml',
            ploneintranet.invitations,
            context=configurationContext
        )

        xmlconfig.file(
            'configure.zcml',
            Products.CMFPlacefulWorkflow,
            context=configurationContext
        )

        xmlconfig.file(
            'configure.zcml',
            ploneintranet.theme,
            context=configurationContext
        )

        # Install products that use an old-style initialize() function
        z2.installProduct(app, 'collective.workspace')
        z2.installProduct(app, 'Products.CMFPlacefulWorkflow')
Exemplo n.º 12
0
    def setUpZope(self, app, configurationContext):
        # Load ZCML
        for package in self.dependencies:
            module = __import__(package, fromlist=[''])
            self.loadZCML(package=module)

        import collective.customizablePersonalizeForm
        xmlconfig.includeOverrides(configurationContext,
                'overrides.zcml',
                package=collective.customizablePersonalizeForm)

        for package in self.dependencies:
            z2.installProduct(app, package)
Exemplo n.º 13
0
def loadProductsOverrides(_context, file=None):
    if file is None:
        # set the default
        file = 'overrides.zcml'
    
    # now load the files if they exist
    for product in findProducts():
        zcml = os.path.join(os.path.dirname(product.__file__), file)
        if os.path.isfile(zcml):
            try:
                xmlconfig.includeOverrides(_context, zcml, package=product)
            except: # Yes, really, *any* kind of error.
                handleBrokenProduct(product)
Exemplo n.º 14
0
def loadProductsOverrides(_context, file=None, files=None, package=None):
    if file is None:
        # set the default
        file = 'overrides.zcml'

    if files is not None or package is not None:
        raise ValueError("Neither the files or package argument is supported.")

    # now load the files if they exist
    for product in findProducts():
        zcml = os.path.join(os.path.dirname(product.__file__), file)
        if os.path.isfile(zcml):
            xmlconfig.includeOverrides(_context, zcml, package=product)
Exemplo n.º 15
0
def loadProductsOverrides(_context, file=None, files=None, package=None):
    if file is None:
        # set the default
        file = 'overrides.zcml'

    if files is not None or package is not None:
        raise ValueError("Neither the files or package argument is supported.")

    # now load the files if they exist
    for product in findProducts():
        zcml = os.path.join(os.path.dirname(product.__file__), file)
        if os.path.isfile(zcml):
            xmlconfig.includeOverrides(_context, zcml, package=product)
Exemplo n.º 16
0
    def setUpZope(self, app, configurationContext):
        # Load ZCML
        for package in self.dependencies:
            module = __import__(package, fromlist=[''])
            self.loadZCML(package=module)

        import collective.customizablePersonalizeForm
        xmlconfig.includeOverrides(
            configurationContext,
            'overrides.zcml',
            package=collective.customizablePersonalizeForm)

        for package in self.dependencies:
            z2.installProduct(app, package)
Exemplo n.º 17
0
def includeZCMLGroup(_context, info, filename, override=False):
    includable_zcml = info[filename]
    # ^^ a key error would mean that we are trying to include a group of ZCML
    #    with a filename that wasn't ever searched for. that *should* be an error

    zcml_context = repr(_context.info)

    for dotted_name in includable_zcml:
        log.debug('including file %s from package %s at %s', filename, dotted_name, zcml_context)

    for dotted_name in includable_zcml:
        includable_package = resolve(dotted_name)
        if override:
            includeOverrides(_context, filename, includable_package)
        else:
            include(_context, filename, includable_package)
Exemplo n.º 18
0
def includeZCMLGroup(_context, info, filename, override=False):
    includable_zcml = info[filename]
    # ^^ a key error would mean that we are trying to include a group of ZCML
    #    with a filename that wasn't ever searched for. that *should* be an error

    zcml_context = repr(_context.info)

    for dotted_name in includable_zcml:
        log.debug('including file %s from package %s at %s', filename,
                  dotted_name, zcml_context)

    for dotted_name in includable_zcml:
        includable_package = resolve(dotted_name)
        if override:
            includeOverrides(_context, filename, includable_package)
        else:
            include(_context, filename, includable_package)
Exemplo n.º 19
0
def load_zcml_file(context,
                   module_name,
                   package=None,
                   zcml="configure.zcml",
                   override=False):
    filename = get_zcml_file(module_name, zcml)
    if not filename:
        return
    if package is None and context.package is not None:
        package = context.package
    if override:
        logger.debug(
            f"Loading {module_name}:{zcml} from {filename} in override mode.")
        # The package as third argument seems not needed because we have an absolute file name.
        # But it *is* needed when that file loads other relative files.
        includeOverrides(context, filename, package)
    else:
        logger.debug(f"Loading {module_name}:{zcml} from {filename}")
        include(context, filename, package)
Exemplo n.º 20
0
    def setUpZope(self, app, configurationContext):
        import tutorweb.content
        import tutorweb.content.tests.mockviews
        import collective.alias
        xmlconfig.include(configurationContext, 'meta.zcml', tutorweb.content)
        xmlconfig.include(configurationContext, 'configure.zcml', tutorweb.content)
        xmlconfig.include(configurationContext, 'configure.zcml', tutorweb.content.tests.mockviews)
        xmlconfig.includeOverrides(configurationContext, 'overrides.zcml', tutorweb.content)
        xmlconfig.include(configurationContext, 'configure.zcml', collective.alias)
        configurationContext.execute_actions()

        config = getConfiguration()
        if not hasattr(config, 'product_config'):
            config.product_config = {}
        config.product_config['tutorweb.content'] = {
            'settings-documentation': os.path.join(os.path.dirname(__file__), 'example_settings.rst'),
        }

        # https://github.com/plone/plone.app.event/issues/81#issuecomment-23930996
        installProduct(app, 'Products.DateRecurringIndex')
Exemplo n.º 21
0
def load(_context, target):
    include = xmlconfig.include

    for ep in pkr.iter_entry_points('topp.zcmlloader'):
        if ep.name != target:
            continue
        dotted_name = ep.module_name

        for zcmlgroup in ('configure.zcml', 'meta.zcml'):
            filename = pkr.resource_filename(dotted_name, zcmlgroup)
            if not os.path.isfile(filename): continue
            dep_package = ep.load()
            if zcmlgroup == 'overrides.zcml':
                include = xcmlconfig.includeOverrides
            xmlconfig.include(_context, file=filename, package=dep_package)
            print 'Found configuration file %s: <include package="%s" file="%s" />' % (filename, dotted_name, zcmlgroup)

        for zcmlgroup in ('overrides.zcml',):
            filename = pkr.resource_filename(dotted_name, zcmlgroup)
            if not os.path.isfile(filename): continue
            dep_package = ep.load()
            xmlconfig.includeOverrides(_context, file=filename, package=dep_package)
            print 'Found configuration file %s: <includeOverrides package="%s" file="%s" />' % (filename, dotted_name, zcmlgroup)
 def _callFUT(self, *args, **kw):
     from zope.configuration.xmlconfig import includeOverrides
     return includeOverrides(*args, **kw)
Exemplo n.º 23
0
def loadProductsOverrides(_context):
    for product in findProducts():
        zcml = os.path.join(os.path.dirname(product.__file__),
                            'overrides.zcml')
        if os.path.isfile(zcml):
            xmlconfig.includeOverrides(_context, zcml, package=product)
Exemplo n.º 24
0
def loadProductsOverrides(_context):
    for product in findProducts():
        zcml = os.path.join(os.path.dirname(product.__file__), "overrides.zcml")
        if os.path.isfile(zcml):
            xmlconfig.includeOverrides(_context, zcml, package=product)
Exemplo n.º 25
0
 def setUpZope(self, app, configurationContext):
     import tutorweb.content
     xmlconfig.include(configurationContext, 'meta.zcml', tutorweb.content)
     xmlconfig.include(configurationContext, 'configure.zcml', tutorweb.content)
     xmlconfig.includeOverrides(configurationContext, 'overrides.zcml', tutorweb.content)
     configurationContext.execute_actions()
Exemplo n.º 26
0
    def setUpZope(self, app, configurationContext):
        import dexterity.membrane
        self.loadZCML(package=dexterity.membrane)

        import plone.app.dexterity
        self.loadZCML(package=plone.app.dexterity)

        import plone.app.versioningbehavior
        self.loadZCML(package=plone.app.versioningbehavior)

        import plone.app.collection
        self.loadZCML(package=plone.app.collection)

        import plone.namedfile
        self.loadZCML(package=plone.namedfile)

        import collective.z3cform.html5widgets
        self.loadZCML(package=collective.z3cform.html5widgets)

        import collective.js.jqueryui
        self.loadZCML(package=collective.js.jqueryui)

        import plone.app.versioningbehavior
        self.loadZCML(package=plone.app.versioningbehavior)

        import five.localsitemanager
        self.loadZCML(package=five.localsitemanager)

        import collective.indexing
        self.loadZCML(package=collective.indexing)

        import Products.membrane
        self.loadZCML(package=Products.membrane)
        z2.installProduct(app, 'Products.membrane')  # initialize

        import plone.app.contentrules
        self.loadZCML(package=plone.app.contentrules)

        import plonetheme.classic
        import plonetheme.jquerymobile
        self.loadZCML(package=plonetheme.classic)
        self.loadZCML(package=plonetheme.jquerymobile)

        import Products.DateRecurringIndex
        z2.installProduct(app, 'Products.DateRecurringIndex')

        import plone.app.event
        self.loadZCML(package=plone.app.event)

        import plone.app.contenttypes
        self.loadZCML(package=plone.app.contenttypes)

        import cioppino.twothumbs
        self.loadZCML(package=cioppino.twothumbs)
        z2.installProduct(app, 'cioppino.twothumbs')  # initialize

        import collective.etherpad
        self.loadZCML(package=collective.etherpad)

        import collective.favoriting
        self.loadZCML(package=collective.favoriting)

        import collective.fontawesome
        self.loadZCML(package=collective.fontawesome)

        import collective.history
        self.loadZCML(package=collective.history)

        import collective.js.datatables
        self.loadZCML(package=collective.js.datatables)

        import collective.localrolesdatatables
        self.loadZCML(package=collective.localrolesdatatables)

        import collective.mediaelementjs
        self.loadZCML(package=collective.mediaelementjs)

        import collective.memberdatatables
        self.loadZCML(package=collective.memberdatatables)

        import collective.polls
        self.loadZCML(package=collective.polls)

        import collective.portlet.favoriting
        self.loadZCML(package=collective.portlet.favoriting)
        z2.installProduct(app, 'collective.portlet.favoriting')

        import collective.portlet.localusers
        self.loadZCML(package=collective.portlet.localusers)
        z2.installProduct(app, 'collective.portlet.localusers')

        import collective.readitlater
        self.loadZCML(package=collective.readitlater)

        import collective.themeswitcher
        self.loadZCML(package=collective.themeswitcher)

        import collective.whathappened
        self.loadZCML(package=collective.whathappened)

        import collective.rcse
        self.loadZCML(package=collective.rcse)
        xmlconfig.includeOverrides(configurationContext,
                                   'overrides.zcml',
                                   package=collective.rcse)

        setupCoreSessions(app)
Exemplo n.º 27
0
 def _callFUT(self, *args, **kw):
     from zope.configuration.xmlconfig import includeOverrides
     return includeOverrides(*args, **kw)