comparison profilemanager/manager.py @ 16:c80d44e5ca41

flush out new() function
author Jeff Hammel <jhammel@mozilla.com>
date Thu, 06 May 2010 11:23:23 -0700
parents 543d08958b67
children 8e651dd8e9ad
comparison
equal deleted inserted replaced
15:543d08958b67 16:c80d44e5ca41
29 self.profiles = profiles 29 self.profiles = profiles
30 self.profile_dir = os.path.abspath(os.path.dirname(profiles)) 30 self.profile_dir = os.path.abspath(os.path.dirname(profiles))
31 31
32 ### (public) API 32 ### (public) API
33 33
34 def new(self, name): 34 def new(self, name, directory=None, hash=True):
35 """ 35 """
36 generate a new clean profile 36 generate a new clean profile
37 - name: name of the profile to generate 37 - name: name of the profile to generate
38 - directory: where to create the profile [DEFAULT: relative to profiles.ini]
39 - hash: whether to generate a a random hash tag
38 """ 40 """
39 raise NotImplementedError 41
42 # path to the profile directory
43 dirname = name
44 if hash:
45 dirname = '%s.%s' % self.hash()
46 if not directory:
47 directory = self.profile_dir
48 dirname = os.path.join(directory, dirname)
49
50 # create directory
51 # TODO: (optionally) pre-populate the directory a la FF
52 os.mkdir(dirname)
53
54 # return the directory name
55 return dirname
40 56
41 def list(self, directories=False): 57 def list(self, directories=False):
42 """ 58 """
43 lists the profiles available in the config file 59 lists the profiles available in the config file
44 - directories : display the directories 60 - directories : display the directories