diff profilemanager/manager.py @ 21:15484adb9758

note what section a a profile is in
author Jeff Hammel <jhammel@mozilla.com>
date Thu, 06 May 2010 15:24:50 -0700
parents 49d523a33c89
children 956f5a4c589a
line wrap: on
line diff
--- 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):
         """