Mercurial > mozilla > hg > ProfileManager
changeset 16:c80d44e5ca41
flush out new() function
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Thu, 06 May 2010 11:23:23 -0700 |
parents | 543d08958b67 |
children | d7d051611425 |
files | profilemanager/manager.py |
diffstat | 1 files changed, 18 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/profilemanager/manager.py Thu May 06 11:06:59 2010 -0700 +++ b/profilemanager/manager.py Thu May 06 11:23:23 2010 -0700 @@ -31,12 +31,28 @@ ### (public) API - def new(self, name): + def new(self, name, directory=None, hash=True): """ generate a new clean profile - name: name of the profile to generate + - directory: where to create the profile [DEFAULT: relative to profiles.ini] + - hash: whether to generate a a random hash tag """ - raise NotImplementedError + + # path to the profile directory + dirname = name + if hash: + dirname = '%s.%s' % self.hash() + if not directory: + directory = self.profile_dir + dirname = os.path.join(directory, dirname) + + # create directory + # TODO: (optionally) pre-populate the directory a la FF + os.mkdir(dirname) + + # return the directory name + return dirname def list(self, directories=False): """