[Zope-Checkins] CVS: Zope3/lib/python/Zope/Configuration - name.py:1.1.2.12.10.1 xmlconfig.py:1.1.2.15.8.3
Jim Fulton
jim@zope.com
Sun, 2 Jun 2002 10:35:27 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/Configuration
In directory cvs.zope.org:/tmp/cvs-serv29793/lib/python/Zope/Configuration
Modified Files:
Tag: Zope3InWonderland-branch
name.py xmlconfig.py
Log Message:
- Added template attribute to allow views to be created from a
template source file.
- Added beginnings of a Zope debugger. This required seperating site
and server configuration.
- Added the ability to specify a config file package in the
zopeConfigure directive. Made "config.zcml" a default for the file
attribute in the include directive.
- Fixed mapply to unwrap proxied objects. This was necessary once
views became wrapped in proxies. We need to investigate why they
weren't being wrapped before.
- I updated enough system page templates and zcml directives so that:
- Zope now starts. :)
- The root folder contents listing can be viewed.
Many more templates and zcml files need to be updated to reflect the
way views are now handled.
=== Zope3/lib/python/Zope/Configuration/name.py 1.1.2.12 => 1.1.2.12.10.1 ===
"""
+import os
import sys
from types import ModuleType
@@ -67,4 +68,17 @@
name=".".join(name)
if repeat:
name+="+"
- return name
\ No newline at end of file
+ return name
+
+def path(file='', package = 'ZopeProducts', _silly=('__doc__',), _globals={}):
+ try: package = __import__(package, _globals, _globals, _silly)
+ except ImportError:
+ if file and os.path.abspath(file) == file:
+ # The package didn't matter
+ return file
+ raise
+
+ path = os.path.split(package.__file__)[0]
+ if file:
+ path = os.path.join(file)
+ return path
=== Zope3/lib/python/Zope/Configuration/xmlconfig.py 1.1.2.15.8.2 => 1.1.2.15.8.3 ===
"""
+import os
import name
from xml.sax import make_parser
from xml.sax.xmlreader import InputSource
@@ -77,6 +78,12 @@
if name != self.__top_name:
raise ZopeXMLConfigurationError(
self.__locator, "Invalid top element: %s %s" % name)
+
+ for (ns, aname), value in attrs.items():
+ if ns is None:
+ self.__context.file_attr(aname, value)
+
+
stack.append(None)
return
@@ -169,6 +176,15 @@
def getNormalizedName(self, dottedname):
return name.getNormalizedName(dottedname, self.__package)
+ def path(self, file=None):
+ return name.path(file, self.__package)
+
+ def file_attr(self, name, value):
+ if name == 'package':
+ self.__package = value
+ else:
+ raise TypeError, "Unrecognized config file attribute: %s" % name
+
def xmlconfig(file, actions=None, context=None, directives=None):
if context is None:
@@ -223,7 +239,7 @@
xmlconfig(f, self._actions, Context(self._stack), self._directives)
f.close()
- def include(self, _context, file, package=None):
+ def include(self, _context, file='config.zcml', package=None):
if package is not None:
try:
package = _context.resolve(package)