comparison profilemanager/manager.py @ 73:1cfd259f74cf

finish dated backups, untested
author Jeff Hammel <jhammel@mozilla.com>
date Fri, 07 May 2010 16:30:34 -0700
parents 494ea3c2f578
children b6bb59b79525
comparison
equal deleted inserted replaced
72:619f5918b998 73:1cfd259f74cf
216 - date : date to restore from (will not delete) 216 - date : date to restore from (will not delete)
217 - delete : delete the backup after restoration 217 - delete : delete the backup after restoration
218 """ 218 """
219 219
220 assert not (date and delete), 'date and delete cannot be used in conjunction' 220 assert not (date and delete), 'date and delete cannot be used in conjunction'
221 orig_date = date
221 222
222 # get the path to the profile 223 # get the path to the profile
223 path = self.path(profile) 224 path = self.path(profile)
224 225
225 # get the possible backups 226 # get the possible backups
246 if isinstance(date, datetime): 247 if isinstance(date, datetime):
247 # convert to s since epoch 248 # convert to s since epoch
248 date = time.mktime(date.timetuple()) 249 date = time.mktime(date.timetuple())
249 250
250 for backup in backups: 251 for backup in backups:
251 raise NotImplementedError 252 if backup[1] < date:
253 break
254 else:
255 raise NoBackupError("No backups for profile %s in %s earlier than %s" % (profile, self.profiles, orig_date))
252 else: 256 else:
253 if not backups: 257 if not backups:
254 raise NoBackupError("No backups for profile %s in %s" % (profile, self.profiles)) 258 raise NoBackupError("No backups for profile %s in %s" % (profile, self.profiles))
255 backup = backups[0] 259 backup = backups[0]
256 260