62 |
62 |
63 def config(self, section, name, default=None): |
63 def config(self, section, name, default=None): |
64 if self.overlay.has_key((section, name)): |
64 if self.overlay.has_key((section, name)): |
65 return self.overlay[(section, name)] |
65 return self.overlay[(section, name)] |
66 if self.cdata.has_option(section, name): |
66 if self.cdata.has_option(section, name): |
67 return self.cdata.get(section, name) |
67 try: |
|
68 return self.cdata.get(section, name) |
|
69 except ConfigParser.InterpolationError, inst: |
|
70 raise util.Abort(_("Error in configuration:\n%s") % inst) |
68 if self.parentui is None: |
71 if self.parentui is None: |
69 return default |
72 return default |
70 else: |
73 else: |
71 return self.parentui.config(section, name, default) |
74 return self.parentui.config(section, name, default) |
72 |
75 |
73 def configbool(self, section, name, default=False): |
76 def configbool(self, section, name, default=False): |
74 if self.overlay.has_key((section, name)): |
77 if self.overlay.has_key((section, name)): |
75 return self.overlay[(section, name)] |
78 return self.overlay[(section, name)] |
76 if self.cdata.has_option(section, name): |
79 if self.cdata.has_option(section, name): |
77 return self.cdata.getboolean(section, name) |
80 try: |
|
81 return self.cdata.getboolean(section, name) |
|
82 except ConfigParser.InterpolationError, inst: |
|
83 raise util.Abort(_("Error in configuration:\n%s") % inst) |
78 if self.parentui is None: |
84 if self.parentui is None: |
79 return default |
85 return default |
80 else: |
86 else: |
81 return self.parentui.configbool(section, name, default) |
87 return self.parentui.configbool(section, name, default) |
82 |
88 |
83 def configitems(self, section): |
89 def configitems(self, section): |
84 items = {} |
90 items = {} |
85 if self.parentui is not None: |
91 if self.parentui is not None: |
86 items = dict(self.parentui.configitems(section)) |
92 items = dict(self.parentui.configitems(section)) |
87 if self.cdata.has_section(section): |
93 if self.cdata.has_section(section): |
88 items.update(dict(self.cdata.items(section))) |
94 try: |
|
95 items.update(dict(self.cdata.items(section))) |
|
96 except ConfigParser.InterpolationError, inst: |
|
97 raise util.Abort(_("Error in configuration:\n%s") % inst) |
89 x = items.items() |
98 x = items.items() |
90 x.sort() |
99 x.sort() |
91 return x |
100 return x |
92 |
101 |
93 def walkconfig(self, seen=None): |
102 def walkconfig(self, seen=None): |