# HG changeset patch # User Jeff Hammel # Date 1273184690 25200 # Node ID 15484adb9758f9f55283e2ca15075fb983c8bcf6 # Parent 49d523a33c89b41d8c9e75b82cc76aabf6bbd302 note what section a a profile is in diff -r 49d523a33c89 -r 15484adb9758 profilemanager/manager.py --- a/profilemanager/manager.py Thu May 06 13:02:08 2010 -0700 +++ b/profilemanager/manager.py Thu May 06 15:24:50 2010 -0700 @@ -77,7 +77,9 @@ remove a profile from profiles.ini - delete: delete the profile directory as well """ - raise NotImplementedError + section = self.section(name) + if section is None: + raise ProfileNotFound def list(self, directories=False): """ @@ -186,8 +188,16 @@ def section(self, profile): """ - returns the name of the section that a profile is in + returns the name of the section that a profile is in or None + if not found """ + parser = ConfigParser() + parser.read(self.profiles) + for section in parser.section(): + if not parser.has_option(section, 'name'): + continue # not a profile + if parser.get(section, 'name') == profile: + return section def profiles_dict(self): """