[Zope-Checkins] CVS: Zope/lib/python/ZConfig - ApacheStyle.py:1.1.4.2 Config.py:1.2.4.2 Context.py:1.1.4.3

Chris McDonough chrism@zope.com
Sat, 26 Oct 2002 15:52:18 -0400


Update of /cvs-repository/Zope/lib/python/ZConfig
In directory cvs.zope.org:/tmp/cvs-serv31373/lib/python/ZConfig

Modified Files:
      Tag: chrism-install-branch
	ApacheStyle.py Config.py Context.py 
Log Message:
Merge with HEAD.  Again, sorry for the spew (what's left of it... someone seems to have filtered some of this branch's checkins out).


=== Zope/lib/python/ZConfig/ApacheStyle.py 1.1.4.1 => 1.1.4.2 ===
--- Zope/lib/python/ZConfig/ApacheStyle.py:1.1.4.1	Thu Oct 10 14:29:12 2002
+++ Zope/lib/python/ZConfig/ApacheStyle.py	Sat Oct 26 15:51:46 2002
@@ -76,6 +76,8 @@
             newurl = urlparse.urljoin(section.url, value)
             context.includeConfiguration(section, newurl)
         else:
+            if not value:
+                value = ''
             try:
                 section.addValue(key, value)
             except ConfigurationError, e:


=== Zope/lib/python/ZConfig/Config.py 1.2.4.1 => 1.2.4.2 ===
--- Zope/lib/python/ZConfig/Config.py:1.2.4.1	Thu Oct 10 14:29:12 2002
+++ Zope/lib/python/ZConfig/Config.py	Sat Oct 26 15:51:46 2002
@@ -87,6 +87,15 @@
         key = key.lower()
         self._data[key] = value
 
+    def has_key(self, key):
+        key = key.lower()
+        if self._data.has_key(key):
+            return True
+        elif self.delegate:
+            return self.delegate.has_key(key)
+        else:
+            return False
+
     def items(self):
         """Returns a list of key-value pairs for this section.
 
@@ -116,6 +125,18 @@
                     L2.append(k)
             return L2
 
+    def __getitem__(self, key):
+        k = key.lower()
+        if self._data.has_key(k):
+            return self._data[k]
+        elif self.delegate:
+            v = self.delegate.get(k)
+            if v is None:
+                raise KeyError(key)
+            return v
+        else:
+            raise KeyError(key)
+
     def get(self, key, default=None):
         key = key.lower()
         try:
@@ -166,6 +187,14 @@
         if max is not None and x > max:
             raise ValueError("value for %s must be no more than %s, found %s"
                              % (repr(key), max, x))
+
+    def getlist(self, key, default=None):
+        missing = []
+        s = self.get(key, missing)
+        if s is missing:
+            return default
+        else:
+            return s.split()
 
 
 class ImportingConfiguration(Configuration):


=== Zope/lib/python/ZConfig/Context.py 1.1.4.2 => 1.1.4.3 ===
--- Zope/lib/python/ZConfig/Context.py:1.1.4.2	Tue Oct 15 20:53:38 2002
+++ Zope/lib/python/ZConfig/Context.py	Sat Oct 26 15:51:46 2002
@@ -111,7 +111,8 @@
     # internal helpers
 
     def _parse_url(self, url, section):
-        if urlparse.urlparse(url)[-1]:
+        url, fragment = urlparse.urldefrag(url)
+        if fragment:
             raise ConfigurationError(
                 "fragment identifiers are not currently supported")
         file = urllib2.urlopen(url)