本文整理汇总了Python中zope.configuration.xmlconfig.string函数的典型用法代码示例。如果您正苦于以下问题:Python string函数的具体用法?Python string怎么用?Python string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了string函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUpZope
def setUpZope(self, app, configurationContext):
xmlconfig.string(
'<configure xmlns="http://namespaces.zope.org/zope">'
' <include package="z3c.autoinclude" file="meta.zcml" />'
' <includePlugins package="plone" />'
' <includePluginsOverrides package="plone" />'
'</configure>',
context=configurationContext)
# Load ZCML
import ftw.subsite
xmlconfig.file('configure.zcml', ftw.subsite,
context=configurationContext)
xmlconfig.file('overrides.zcml', ftw.subsite,
context=configurationContext)
# import plone.app.portlets
# xmlconfig.file('configure.zcml', plone.app.portlets,
# context=configurationContext)
# import collective.MockMailHost
# xmlconfig.file('configure.zcml', collective.MockMailHost,
# context=configurationContext)
# installProduct() is *only* necessary for packages outside
# the Products.* namespace which are also declared as Zope 2 products,
# using <five:registerPackage /> in ZCML.
z2.installProduct(app, 'plone.app.portlets')
z2.installProduct(app, 'ftw.subsite')
z2.installProduct(app, 'ftw.simplelayout')
z2.installProduct(app, 'collective.MockMailHost')
示例2: setUpProducts
def setUpProducts(self, app):
super(ZopeLayer, self).setUpProducts(app)
configurationContext = self['configurationContext']
# Plone < 4.3
import Products.GenericSetup
xmlconfig.file('meta.zcml', Products.GenericSetup,
context=configurationContext)
import Products.CMFPlacefulWorkflow
xmlconfig.file('configure.zcml', Products.CMFPlacefulWorkflow,
context=configurationContext)
if IS_PLONE_5:
xmlconfig.string('''
<configure>
<include package="plone.app.caching" />
<include package="plonetheme.barceloneta" />
</configure>''', context=configurationContext)
z2.installProduct(app, 'Products.CMFPlacefulWorkflow')
import Products.Five
xmlconfig.file('meta.zcml', Products.Five,
context=configurationContext)
import ftw.inflator
xmlconfig.file('configure.zcml', ftw.inflator,
context=configurationContext)
xmlconfig.file('overrides.zcml', ftw.inflator,
context=configurationContext)
xmlconfig.file('configure.zcml', ftw.inflator.tests,
context=configurationContext)
apply_patches()
示例3: setUpZope
def setUpZope(self, app, configurationContext):
xmlconfig.string(
'<configure xmlns="http://namespaces.zope.org/zope">'
' <include package="z3c.autoinclude" file="meta.zcml" />'
' <includePlugins package="plone" />'
' <includePluginsOverrides package="plone" />'
"</configure>",
context=configurationContext,
)
import Products.CMFPlacefulWorkflow
xmlconfig.file("configure.zcml", Products.CMFPlacefulWorkflow, context=configurationContext)
try:
# Plone >= 4.3.x
import Products.DataGridField
xmlconfig.file("configure.zcml", Products.DataGridField, context=configurationContext)
except:
pass
z2.installProduct(app, "ftw.file")
z2.installProduct(app, "ftw.meeting")
z2.installProduct(app, "ftw.mail")
z2.installProduct(app, "ftw.workspace")
示例4: setUpZope
def setUpZope(self, app, configurationContext):
import Products.CMFPlacefulWorkflow
xmlconfig.file('configure.zcml', Products.CMFPlacefulWorkflow,
context=configurationContext)
z2.installProduct(app, 'Products.CMFPlacefulWorkflow')
if IS_PLONE_APP_MULTILINGUAL_2:
z2.installProduct(app, 'Products.DateRecurringIndex')
import ftw.inflator
xmlconfig.file('configure.zcml', ftw.inflator,
context=configurationContext)
xmlconfig.file('configure.zcml', ftw.inflator.tests,
context=configurationContext)
import plone.app.multilingual
xmlconfig.file('configure.zcml', plone.app.multilingual,
context=configurationContext)
import plone.app.dexterity
xmlconfig.file('configure.zcml', plone.app.dexterity,
context=configurationContext)
xmlconfig.string(
'<configure xmlns="http://namespaces.zope.org/zope">'
' <include package="z3c.autoinclude" file="meta.zcml" />'
' <includePlugins package="plone" />'
' <includePluginsOverrides package="plone" />'
'</configure>',
context=configurationContext)
setupCoreSessions(app)
示例5: test_configure
def test_configure(self):
_ = xmlconfig.string(r"""
<configure xmlns="http://namespaces.zope.org/browser" i18n_domain="zope">
<include package="zope.browsermenu" file="meta.zcml" />
<menu
id="zmi_views"
title="Views"
/>
<menu
id="zmi_actions"
title="Actions"
/>
</configure>
""")
xmlconfig.string(r"""
<configure xmlns="http://namespaces.zope.org/zope">
<include package="zope.app.broken" />
</configure>
""")
from zope import component
from zope.interface import implementer
from zope.publisher.interfaces.browser import IDefaultBrowserLayer
@implementer(IDefaultBrowserLayer)
class Layer(object):
pass
self.assertIsNotNone(component.getMultiAdapter(
(Broken(), Layer()),
name='index.html'))
示例6: testRegisterDistributedTranslations
def testRegisterDistributedTranslations(self):
from zope.configuration import xmlconfig
self.assert_(queryUtility(ITranslationDomain, 'zope-i18n') is None)
xmlconfig.string(
template % '''
<configure package="zope.i18n.tests">
<i18n:registerTranslations directory="locale" />
</configure>
''', self.context)
xmlconfig.string(
template % '''
<configure package="zope.i18n.tests">
<i18n:registerTranslations directory="locale2" />
</configure>
''', self.context)
path1 = os.path.join(os.path.dirname(zope.i18n.tests.__file__),
'locale', 'en', 'LC_MESSAGES', 'zope-i18n.mo')
path2 = os.path.join(os.path.dirname(zope.i18n.tests.__file__),
'locale2', 'en', 'LC_MESSAGES', 'zope-i18n.mo')
util = getUtility(ITranslationDomain, 'zope-i18n')
self.assertEquals(util._catalogs.get('test'), ['test', 'test'])
self.assertEquals(util._catalogs.get('en'),
[unicode(path1), unicode(path2)])
msg = util.translate(u'Additional message', target_language='en')
self.assertEquals(msg, u'Additional message translated')
msg = util.translate(u'New Domain', target_language='en')
self.assertEquals(msg, u'New Domain translated')
msg = util.translate(u'New Language', target_language='en')
self.assertEquals(msg, u'New Language translated')
示例7: setUpZope
def setUpZope(self, app, configurationContext):
# Load ZCML for this package
# xmlconfig.file('configure.zcml', Products.DateRecurringIndex,
# context=configurationContext)
# xmlconfig.file('configure.zcml', plone.app.event,
# context=configurationContext)
z2.installProduct(app, 'Products.DateRecurringIndex')
xmlconfig.file('configure.zcml', plone.app.contenttypes,
context=configurationContext)
xmlconfig.file('configure.zcml', collective.tinymcetiles,
context=configurationContext)
xmlconfig.file('configure.zcml', plone.app.contentlistingtile,
context=configurationContext)
xmlconfig.string("""\
<configure package="collective.tinymcetiles"
xmlns="http://namespaces.plone.org/plone">
<tile
name="dummy.tile"
title="Dummy tile"
description="dummy"
add_permission="cmf.ModifyPortalContent"
class=".testing.DummyTile"
permission="zope2.View"
for="*"
/>
</configure>
""", context=configurationContext)
示例8: setUpZope
def setUpZope(self, app, configurationContext):
xmlconfig.string(
'<configure xmlns="http://namespaces.zope.org/zope">'
' <include package="z3c.autoinclude" file="meta.zcml" />'
' <includePlugins package="plone" />'
' <includePluginsOverrides package="plone" />'
' <include package="Products.CMFPlacefulWorkflow" />'
'</configure>',
context=configurationContext)
# DatagridField doesn't define the auto-include entry point
import Products.DataGridField
xmlconfig.file('configure.zcml',
Products.DataGridField,
context=configurationContext)
z2.installProduct(app, 'ftw.workspace')
z2.installProduct(app, 'ftw.file')
z2.installProduct(app, 'ftw.meeting')
z2.installProduct(app, 'Products.DataGridField')
z2.installProduct(app, 'egov.contactdirectory')
z2.installProduct(app, 'Products.CMFPlacefulWorkflow')
# Dep. of egov.contactdirectory
z2.installProduct(app, 'ftw.contentpage')
z2.installProduct(app, 'simplelayout.types.common')
示例9: setUpZCML
def setUpZCML(self):
"""Load the basic ZCML configuration from Five. Exposes a resource
``configurationContext`` which can be used to load further ZCML.
"""
# Push a new global registry so that we can cleanly tear down all ZCML
from plone.testing import zca
zca.pushGlobalRegistry()
# Load something akin to the default site.zcml without actually auto-
# loading products
self['configurationContext'] = context = zca.stackConfigurationContext(self.get('configurationContext'))
from zope.configuration import xmlconfig
xmlconfig.string("""\
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:meta="http://namespaces.zope.org/meta">
<include package="Products.Five" />
<meta:redefinePermission from="zope2.Public" to="zope.Public" />
<securityPolicy component="Products.Five.security.FiveSecurityPolicy" />
</configure>
""", context=context)
示例10: zcml
def zcml(s, execute=True):
from zope.app.appsetup.appsetup import __config_context as context
try:
xmlconfig.string(s, context, execute=execute)
except:
context.end()
raise
示例11: setUpZope
def setUpZope(self, app, configurationContext):
# load ZCML
import plone.app.blocks
self.loadZCML(package=plone.app.blocks)
# Register directory for testing
xmlconfig.string("""\
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:plone="http://namespaces.plone.org/plone"
i18n_domain="plone"
package="plone.app.blocks.tests">
<plone:static
type="sitelayout"
name="testlayout1"
directory="resources/sitelayout/testlayout1"
/>
<plone:static
type="sitelayout"
name="testlayout2"
directory="resources/sitelayout/testlayout2"
/>
</configure>
""", context=configurationContext)
if 'virtual_hosting' not in app.objectIds():
# If ZopeLite was imported, we have no default virtual
# host monster
from Products.SiteAccess.VirtualHostMonster \
import manage_addVirtualHostMonster
manage_addVirtualHostMonster(app, 'virtual_hosting')
示例12: initialize_1
def initialize_1(config_path=None):
"""First initialization step.
* Zope component architecture
* The configuration system
* Run-time directories
:param config_path: The path to the configuration file.
:type config_path: string
"""
zcml = resource_string('mailman.config', 'configure.zcml')
xmlconfig.string(zcml)
# By default, set the umask so that only owner and group can read and
# write our files. Specifically we must have g+rw and we probably want
# o-rwx although I think in most cases it doesn't hurt if other can read
# or write the files.
os.umask(0o007)
# Initialize configuration event subscribers. This must be done before
# setting up the configuration system.
from mailman.app.events import initialize as initialize_events
initialize_events()
# config_path will be set if the command line argument -C is given. That
# case overrides all others. When not given on the command line, the
# configuration file is searched for in the file system.
if config_path is None:
config_path = search_for_configuration_file()
elif config_path is INHIBIT_CONFIG_FILE:
# For the test suite, force this back to not using a config file.
config_path = None
mailman.config.config.load(config_path)
示例13: setUpZope
def setUpZope(self, app, configurationContext):
# load ZCML
import plone.app.blocks
self.loadZCML(package=plone.app.blocks)
# Register directory for testing
xmlconfig.string("""\
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:plone="http://namespaces.plone.org/plone"
i18n_domain="plone"
package="plone.app.blocks.tests">
<plone:static
type="sitelayout"
name="testlayout1"
directory="resources/sitelayout/testlayout1"
/>
<plone:static
type="sitelayout"
name="testlayout2"
directory="resources/sitelayout/testlayout2"
/>
</configure>
""", context=configurationContext)
示例14: apply_customization_ui
def apply_customization_ui():
"""Called from ui.app.on_wsgi_application_created_event -- must be called
AFTER custom types have been catalysed.
"""
# combine config string and execute it
zcml = ZCML_SLUG.format(ui_zcml_decls="".join([ zd for zd in UI_ZC_DECLS ]))
log.debug("Executing UI feature configuration:\n%s" % (zcml))
xmlconfig.string(zcml)
示例15: setUpZope
def setUpZope(self, app, configurationContext):
xmlconfig.string(
'<configure xmlns="http://namespaces.zope.org/zope">'
' <include package="z3c.autoinclude" file="meta.zcml" />'
' <includePlugins package="plone" />'
' <includePluginsOverrides package="plone" />'
'</configure>',
context=configurationContext)