[Zope3-checkins] SVN: Zope3/branches/ZopeX3-3.0/src/zope/app/ Backported

Stephan Richter srichter at cosmos.phy.tufts.edu
Thu Aug 12 12:35:12 EDT 2004


Log message for revision 27060:
  Backported
  
  r26501 | srichter | 2004-07-13 14:12:57 -0400 (Tue, 13 Jul 2004) | 7 lines
  r26502 | srichter | 2004-07-13 14:13:52 -0400 (Tue, 13 Jul 2004) | 2 lines
  r26505 | srichter | 2004-07-13 15:04:10 -0400 (Tue, 13 Jul 2004) | 3 lines
  r26506 | srichter | 2004-07-13 15:16:57 -0400 (Tue, 13 Jul 2004) | 2 lines
  r26509 | srichter | 2004-07-13 17:47:43 -0400 (Tue, 13 Jul 2004) | 2 lines
  
  


Changed:
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/apidoc/zcmlmodule/__init__.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/apidoc/zcmlmodule/tests.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/appsetup/appsetup.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/dependable/__init__.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/server/main.py


-=-
Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/apidoc/zcmlmodule/__init__.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/apidoc/zcmlmodule/__init__.py	2004-08-12 16:29:43 UTC (rev 27059)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/apidoc/zcmlmodule/__init__.py	2004-08-12 16:35:12 UTC (rev 27060)
@@ -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
@@ -67,6 +68,8 @@
 
     Demonstration::
 
+      >>> module = ZCMLModule()
+      >>> module._makeDocStructure()
       >>> ns = Namespace(ZCMLModule(), 'http://namespaces.zope.org/browser')
 
       >>> ns.getShortName()
@@ -203,16 +206,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 +225,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 +239,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/branches/ZopeX3-3.0/src/zope/app/apidoc/zcmlmodule/tests.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/apidoc/zcmlmodule/tests.py	2004-08-12 16:29:43 UTC (rev 27059)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/apidoc/zcmlmodule/tests.py	2004-08-12 16:35:12 UTC (rev 27060)
@@ -15,17 +15,18 @@
 
 $Id$
 """
+import os
 import unittest
 from zope.testing.doctestunit import DocTestSuite
 from zope.app.tests import placelesssetup, ztapi
 from zope.app.apidoc.tests import Root
 
+import zope.app.appsetup.appsetup
+from zope.app.location.traversing import LocationPhysicallyLocatable
+from zope.app.traversing.interfaces import IPhysicallyLocatable
 from zope.app.tree.interfaces import IUniqueId
 from zope.app.tree.adapters import LocationUniqueId 
 
-from zope.app.traversing.interfaces import IPhysicallyLocatable
-from zope.app.location.traversing import LocationPhysicallyLocatable
-
 from zope.app.apidoc.zcmlmodule import Namespace, Directive
 from zope.app.apidoc.zcmlmodule import ZCMLModule
 from zope.app.apidoc.tests import Root
@@ -38,8 +39,15 @@
     ztapi.provideAdapter(None, IPhysicallyLocatable,
                          LocationPhysicallyLocatable)
 
+    # Fix up path for tests.
+    global old_source_file
+    old_source_file = zope.app.appsetup.appsetup.__config_source
+    zope.app.appsetup.appsetup.__config_source = os.path.join(
+        os.path.dirname(zope.app.__file__), 'meta.zcml')
+
 def tearDown():
     placelesssetup.tearDown()
+    zope.app.appsetup.appsetup.__config_source = old_source_file    
 
 def getDirective():
     module = ZCMLModule()
@@ -54,7 +62,8 @@
 
 def test_suite():
     return unittest.TestSuite((
-        DocTestSuite('zope.app.apidoc.zcmlmodule'),
+        DocTestSuite('zope.app.apidoc.zcmlmodule',
+                     setUp=setUp, tearDown=tearDown),
         DocTestSuite('zope.app.apidoc.zcmlmodule.browser',
                      setUp=setUp, tearDown=tearDown),
         ))

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/appsetup/appsetup.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/appsetup/appsetup.py	2004-08-12 16:29:43 UTC (rev 27059)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/appsetup/appsetup.py	2004-08-12 16:35:12 UTC (rev 27060)
@@ -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

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/dependable/__init__.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/dependable/__init__.py	2004-08-12 16:29:43 UTC (rev 27059)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/dependable/__init__.py	2004-08-12 16:35:12 UTC (rev 27060)
@@ -11,20 +11,17 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""
+"""Dependable Framework.
+
 $Id$
 """
-
-__metaclass__ = type
-
 from interfaces import IDependable
 from zope.app.annotation.interfaces import IAnnotations
 from zope.app.traversing.api import getParent, canonicalPath, getPath
 from zope.interface import implements
 
 
-class PathSetAnnotation:
-
+class PathSetAnnotation(object):
     """Abstract base class for annotations that are sets of paths.
 
     To make this into a concrete class, a subclass must set the class

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/server/main.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/server/main.py	2004-08-12 16:29:43 UTC (rev 27059)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/server/main.py	2004-08-12 16:35:12 UTC (rev 27060)
@@ -15,7 +15,6 @@
 
 $Id$
 """
-
 import logging
 import os
 import sys
@@ -31,7 +30,6 @@
 
 CONFIG_FILENAME = "zope.conf"
 
-
 class ZopeOptions(zdoptions.ZDOptions):
 
     logsectionname = None



More information about the Zope3-Checkins mailing list