Mercurial > hg
comparison mercurial/ui.py @ 2499:894435215344
Added ui.configlist method to get comma/space separated lists of strings.
For example:
users = alice, bob
colors = red green blue
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Mon, 26 Jun 2006 14:52:26 +0200 |
parents | 1e2ec4fd16df |
children | 18cf95ad3666 |
comparison
equal
deleted
inserted
replaced
2498:1e2ec4fd16df | 2499:894435215344 |
---|---|
92 raise util.Abort(_("Error in configuration:\n%s") % inst) | 92 raise util.Abort(_("Error in configuration:\n%s") % inst) |
93 if self.parentui is None: | 93 if self.parentui is None: |
94 return default | 94 return default |
95 else: | 95 else: |
96 return self.parentui.config(section, name, default) | 96 return self.parentui.config(section, name, default) |
97 | |
98 def configlist(self, section, name, default=None): | |
99 """Return a list of comma/space separated strings""" | |
100 result = self.config(section, name) | |
101 if result is None: | |
102 return [] | |
103 else: | |
104 return result.replace(",", " ").split() | |
105 | |
97 | 106 |
98 def configbool(self, section, name, default=False): | 107 def configbool(self, section, name, default=False): |
99 if self.overlay.has_key((section, name)): | 108 if self.overlay.has_key((section, name)): |
100 return self.overlay[(section, name)] | 109 return self.overlay[(section, name)] |
101 if self.cdata.has_option(section, name): | 110 if self.cdata.has_option(section, name): |