Commit 1576370d authored by Hanno Schlichting's avatar Hanno Schlichting

Reuse IInclude from zope.configuration.xmlconfig.

parent a8b7cd82
......@@ -11,6 +11,10 @@ Trunk (unreleased)
Restructuring
+++++++++++++
- Reuse IInclude from zope.configuration.xmlconfig.
- Reuse IMenuItemType from zope.browsermenu.
- Moved TaintedString from ZPublisher to Shared.
This resolves a circular import issue.
......
......@@ -59,11 +59,14 @@ def handleBrokenProduct(product):
# side. //regebro
LOG.error('Could not import Product %s' % product.__name__, exc_info=True)
def loadProducts(_context, file=None):
def loadProducts(_context, file=None, files=None, package=None):
if file is None:
# set the default
file = 'configure.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)
......@@ -73,11 +76,14 @@ def loadProducts(_context, file=None):
except: # Yes, really, *any* kind of error.
handleBrokenProduct(product)
def loadProductsOverrides(_context, file=None):
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)
......
......@@ -20,7 +20,8 @@ from zope.browserresource.metadirectives import IBasicResourceInformation
from zope.security.zcml import Permission
from zope.configuration.fields import GlobalObject, Tokens, PythonIdentifier
from zope.configuration.fields import Bool
from zope.schema import ASCII, TextLine, BytesLine
from zope.schema import ASCII, TextLine
class IImplementsDirective(Interface):
"""State that a class implements something.
......@@ -147,16 +148,6 @@ class IRegisterClassDirective(Interface):
)
class IInclude(Interface):
file = BytesLine(
title=u'Configuration file name',
description=u'Name of a configuration file to be included for each '
u'installed Product. If the file does not exist, for a '
u'particular product, no error is raised.',
required=False)
class IRegisterPackageDirective(Interface):
"""Registers the given python package which at a minimum fools zope2 into
thinking of it as a zope2 product.
......@@ -173,3 +164,10 @@ class IRegisterPackageDirective(Interface):
u'with a ProductContext instance',
required=False
)
from zope.deferredimport import deprecated
deprecated("Please import from zope.configuration.xmlconfig",
IInclude = 'zope.configuration.xmlconfig:IInclude',
)
......@@ -25,13 +25,13 @@
<meta:directive
name="loadProducts"
schema=".fivedirectives.IInclude"
schema="zope.configuration.xmlconfig.IInclude"
handler=".fiveconfigure.loadProducts"
/>
<meta:directive
name="loadProductsOverrides"
schema=".fivedirectives.IInclude"
schema="zope.configuration.xmlconfig.IInclude"
handler=".fiveconfigure.loadProductsOverrides"
/>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment