Author: dmeyer
Date: Wed Feb  7 16:40:17 2007
New Revision: 2463

Modified:
   trunk/base/src/config.py

Log:
Dict with more than one Var fix; return items in Group in correct order on iter

Modified: trunk/base/src/config.py
==============================================================================
--- trunk/base/src/config.py    (original)
+++ trunk/base/src/config.py    Wed Feb  7 16:40:17 2007
@@ -378,7 +378,7 @@
 
 
     def __iter__(self):
-        return self._dict.__iter__()
+        return self._vars.__iter__()
 
     
 class Dict(Base):
@@ -387,6 +387,8 @@
     """
     def __init__(self, schema, desc=u'', name='', type=unicode, defaults={}):
         super(Dict, self).__init__(name, desc)
+        if isinstance(schema, (list, tuple)):
+            schema = Group(schema=schema, desc=desc, name=name)
         self._schema = schema
         self._dict = {}
         self._type = type
@@ -440,7 +442,7 @@
         """
         ret = []
         prefix = prefix + self._name
-        if type(self._schema) == Var and print_desc:
+        if (type(self._schema) == Var and print_desc) or not self.keys():
             # TODO: more detailed comments, show full spec of var and some 
examples.
             d = unicode_to_str(self._desc).replace('\n', '\n# ')
             ret.append('#\n# %s\n# %s\n#\n' % (prefix, d))
@@ -618,7 +620,7 @@
                 '# this file to change config values, but any other changes\n' 
+ \
                 # FIXME: custom comments lost, would be nice if they were 
kept.  Might
                 # be tricky to fix.
-                '# (including removing or rearranging lines,  or adding 
custom\n' + \
+                '# (including removing or rearranging lines, or adding 
custom\n' + \
                 '# comments) will be lost.\n' + \
                 '#\n' + \
                 '# The available settings are commented out with their 
default\n' + \

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to