[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/ap Store the config
source before the configuration is read and make it
Stephan Richter
srichter at cosmos.phy.tufts.edu
Tue Jul 13 14:12:57 EDT 2004
Log message for revision 26501:
Store the config source before the configuration is read and make it
available via an accessor method.
Then use this method in the zcmlmodule of the API doc tool to read the
meta configuration. I also changed the meta-configuration reading until
someone accesses the API doc tool.
Changed:
U Zope3/trunk/src/zope/app/apidoc/zcmlmodule/__init__.py
U Zope3/trunk/src/zope/app/appsetup/appsetup.py
-=-
Modified: Zope3/trunk/src/zope/app/apidoc/zcmlmodule/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/zcmlmodule/__init__.py 2004-07-13 17:35:45 UTC (rev 26500)
+++ Zope3/trunk/src/zope/app/apidoc/zcmlmodule/__init__.py 2004-07-13 18:12:57 UTC (rev 26501)
@@ -25,6 +25,7 @@
from zope.configuration import docutils, xmlconfig
from zope.interface import implements
+import zope.app.appsetup.appsetup
from zope.app.i18n import ZopeMessageIDFactory as _
from zope.app.location.interfaces import ILocation
from zope.app.apidoc.interfaces import IDocumentationModule
@@ -203,16 +204,14 @@
available attributes.
"""
- def __init__(self):
- """Initialize ZCML Documentation Module."""
+ def _makeDocStructure(self):
# Some trivial caching
global namespaces
global subdirs
- if namespaces is None or subdirs is None:
- from zope import app
- file = os.path.join(os.path.split(app.__file__)[0], 'meta.zcml')
- context = xmlconfig.file(file, execute=False)
- namespaces, subdirs = docutils.makeDocStructures(context)
+ context = xmlconfig.file(
+ zope.app.appsetup.appsetup.getConfigSource(),
+ execute=False)
+ namespaces, subdirs = docutils.makeDocStructures(context)
# Empty keys are not so good for a container
if namespaces.has_key(''):
@@ -224,7 +223,10 @@
"""See zope.app.container.interfaces.IReadContainer
Get the namespace by name; long and abbreviated names work.
- """
+ """
+ if namespaces is None or subdirs is None:
+ self._makeDocStructure()
+
key = unquoteNS(key)
if not (key == 'ALL' or key.startswith('http://namespaces.zope.org/')):
key = 'http://namespaces.zope.org/' + key
@@ -235,6 +237,8 @@
def items(self):
"""See zope.app.container.interfaces.IReadContainer"""
+ if namespaces is None or subdirs is None:
+ self._makeDocStructure()
list = []
for key in namespaces.keys():
namespace = Namespace(self, key)
Modified: Zope3/trunk/src/zope/app/appsetup/appsetup.py
===================================================================
--- Zope3/trunk/src/zope/app/appsetup/appsetup.py 2004-07-13 17:35:45 UTC (rev 26500)
+++ Zope3/trunk/src/zope/app/appsetup/appsetup.py 2004-07-13 18:12:57 UTC (rev 26501)
@@ -46,6 +46,8 @@
def config(file, execute=True):
"""Configure site globals"""
global _configured
+ global __config_source
+ __config_source = file
if _configured:
return
@@ -92,3 +94,8 @@
notify(DatabaseOpened(db))
return db
+
+
+__config_source = None
+def getConfigSource():
+ return __config_source
More information about the Zope3-Checkins
mailing list