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

Reuse IInclude from zope.configuration.xmlconfig.

parent a8b7cd82
...@@ -11,6 +11,10 @@ Trunk (unreleased) ...@@ -11,6 +11,10 @@ Trunk (unreleased)
Restructuring Restructuring
+++++++++++++ +++++++++++++
- Reuse IInclude from zope.configuration.xmlconfig.
- Reuse IMenuItemType from zope.browsermenu.
- Moved TaintedString from ZPublisher to Shared. - Moved TaintedString from ZPublisher to Shared.
This resolves a circular import issue. This resolves a circular import issue.
......
...@@ -59,11 +59,14 @@ def handleBrokenProduct(product): ...@@ -59,11 +59,14 @@ def handleBrokenProduct(product):
# side. //regebro # side. //regebro
LOG.error('Could not import Product %s' % product.__name__, exc_info=True) 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: if file is None:
# set the default # set the default
file = 'configure.zcml' 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 # now load the files if they exist
for product in findProducts(): for product in findProducts():
zcml = os.path.join(os.path.dirname(product.__file__), file) zcml = os.path.join(os.path.dirname(product.__file__), file)
...@@ -73,11 +76,14 @@ def loadProducts(_context, file=None): ...@@ -73,11 +76,14 @@ def loadProducts(_context, file=None):
except: # Yes, really, *any* kind of error. except: # Yes, really, *any* kind of error.
handleBrokenProduct(product) handleBrokenProduct(product)
def loadProductsOverrides(_context, file=None): def loadProductsOverrides(_context, file=None, files=None, package=None):
if file is None: if file is None:
# set the default # set the default
file = 'overrides.zcml' 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 # now load the files if they exist
for product in findProducts(): for product in findProducts():
zcml = os.path.join(os.path.dirname(product.__file__), file) zcml = os.path.join(os.path.dirname(product.__file__), file)
......
...@@ -20,7 +20,8 @@ from zope.browserresource.metadirectives import IBasicResourceInformation ...@@ -20,7 +20,8 @@ from zope.browserresource.metadirectives import IBasicResourceInformation
from zope.security.zcml import Permission from zope.security.zcml import Permission
from zope.configuration.fields import GlobalObject, Tokens, PythonIdentifier from zope.configuration.fields import GlobalObject, Tokens, PythonIdentifier
from zope.configuration.fields import Bool from zope.configuration.fields import Bool
from zope.schema import ASCII, TextLine, BytesLine from zope.schema import ASCII, TextLine
class IImplementsDirective(Interface): class IImplementsDirective(Interface):
"""State that a class implements something. """State that a class implements something.
...@@ -147,16 +148,6 @@ class IRegisterClassDirective(Interface): ...@@ -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): class IRegisterPackageDirective(Interface):
"""Registers the given python package which at a minimum fools zope2 into """Registers the given python package which at a minimum fools zope2 into
thinking of it as a zope2 product. thinking of it as a zope2 product.
...@@ -173,3 +164,10 @@ class IRegisterPackageDirective(Interface): ...@@ -173,3 +164,10 @@ class IRegisterPackageDirective(Interface):
u'with a ProductContext instance', u'with a ProductContext instance',
required=False required=False
) )
from zope.deferredimport import deprecated
deprecated("Please import from zope.configuration.xmlconfig",
IInclude = 'zope.configuration.xmlconfig:IInclude',
)
...@@ -25,13 +25,13 @@ ...@@ -25,13 +25,13 @@
<meta:directive <meta:directive
name="loadProducts" name="loadProducts"
schema=".fivedirectives.IInclude" schema="zope.configuration.xmlconfig.IInclude"
handler=".fiveconfigure.loadProducts" handler=".fiveconfigure.loadProducts"
/> />
<meta:directive <meta:directive
name="loadProductsOverrides" name="loadProductsOverrides"
schema=".fivedirectives.IInclude" schema="zope.configuration.xmlconfig.IInclude"
handler=".fiveconfigure.loadProductsOverrides" 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