def _init_points_(self): '''Internal function which reads the autoresume directory and for existing autoresume points and adds them to our _points variable ''' existing = listdir_files(self.basedir, False) for point in existing: self._points[point] = pjoin(self.basedir, point)
def enable(self, point, data=None): '''Sets the resume point 'ON' @param point: string. name of the resume point to enable @param data: string of information to store, or None @return boolean ''' if point in self._points and not data: return True fname = pjoin(self.basedir, point) if data: with open(fname,"w") as myf: myf.write(data) else: try: fileutils.touch(fname) self._points[point] = fname except Exception as e: log.error('AutoResumeError: %s', e) return False return True
def enable(self, point, data=None): '''Sets the resume point 'ON' @param point: string. name of the resume point to enable @param data: string of information to store, or None @return boolean ''' if point in self._points and not data: return True fname = pjoin(self.basedir, point) if data: with open(fname, "w") as myf: myf.write(data) else: try: touch(fname) self._points[point] = fname except Exception as e: print AutoResumeError(str(e)) return False return True