changeset 41:769447f8cd08

cleanup
author Jeff Hammel <jhammel@mozilla.com>
date Thu, 06 May 2010 18:55:53 -0700
parents 34c740d1962d
children 232188e7c04c
files profilemanager/manager.py
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/profilemanager/manager.py	Thu May 06 18:53:24 2010 -0700
+++ b/profilemanager/manager.py	Thu May 06 18:55:53 2010 -0700
@@ -104,7 +104,7 @@
                 dest = '%s.%s' % (self.hash(), dest)
             dest = os.path.join(self.profile_dir, dest)
 
-        # ensure name is not already present
+
         assert name not in self.profiles_dict(), 'Profile "%s" already in %s' % (name, self.profiles)
 
         # update profiles.ini
@@ -171,19 +171,27 @@
         """
         add a profile entry to profiles.ini
         """
-        assert name not in self.profiles_dict(), 'Profile "%s" already in %s' % (name, self.profiles)
+
+        # ensure name is not already present
+        assert profile not in self.profiles_dict(), 'Profile "%s" already in %s' % (name, self.profiles)
         parser = self.parser()
+
+        # find and add the section 
         ctr = 0
         section = 'Profile%d' % ctr # unsure of this naming convention
         while section in parser.sections():
             ctr += 1
             section = 'Profile%d' % ctr
         parser.add_section(section)
+
+        # add metadata
         parser.set(section, 'Name', profile)
         parser.set(section, 'IsRelative', '%d' % int(relative))
         parser.set(section, 'Path', relative and dirname or path)
         if not ctr:
             parser.set(section, 'Default', '1')
+
+        # write the file
         parser.write(file(self.profiles, 'w'))