[py-configparser-cvs] r9 - trunk

ehuelsmann at common-lisp.net ehuelsmann at common-lisp.net
Fri Jan 18 22:59:10 UTC 2008


Author: ehuelsmann
Date: Fri Jan 18 17:59:09 2008
New Revision: 9

Modified:
   trunk/config.lisp
Log:
Fix issues found while writing tests:

* GET-OPTION: don't forget to pass on DEFAULTS

* %OPTION-VALUE: start doing something sensible


Modified: trunk/config.lisp
==============================================================================
--- trunk/config.lisp	(original)
+++ trunk/config.lisp	Fri Jan 18 17:59:09 2008
@@ -162,19 +162,22 @@
 (defun %option-value (config section option-name &key defaults)
   (if (string= option-name "__name__")
       (section-name section)
-      (let* ((norm-option-name (norm-option-name config option-name)))
-        (labels ((get-value (repositories)
-                   (when (null repositories)
-                     (error 'interpolation-missing-option-error))
-                   ;; no such option error
-                   (let ((option (has-option-p config (section-name section)
-                                               option-name)))
-                     (if option
-                         (cdr option)
+      (let* ((norm-option-name (norm-option-name config option-name))
+             (option (has-option-p config (section-name section) option-name)))
+        (if option
+          (cdr option)
+          (labels ((get-value (repositories)
+                     (when (null repositories)
+                       (error 'interpolation-missing-option-error))
+                     ;; no such option error
+                     (let ((value (assoc norm-option-name (car repositories)
+                                         :test #'string=)))
+                       (if value
+                         (cdr value)
                          (get-value (cdr repositories))))))
           (get-value (list (section-options section)
                            defaults
-                           (defaults config)))))))
+                           (defaults config))))))))
 
 ;; non-API
 (defun %expand-option-value (config section option-value defaults
@@ -234,6 +237,7 @@
              (if expand
                  (%expand-option-value config
                                        section (cdr option)
+                                       defaults
                                        (list option-name))
                  (cdr option))))
         (cond



More information about the Py-configparser-cvs mailing list