def fix(self): """compute fixity based on pathname""" now = secs2utcdatetime() stat = os.stat(self.pathname) self.length = stat.st_size self.fix_time = now self.create_time = secs2utcdatetime(stat.st_ctime) self.mod_time = secs2utcdatetime(stat.st_mtime) if self.checksum_type=='md5': self.checksum = md5_file(self.pathname) elif self.checksum_type=='sha1': self.checksum = sha1_file(self.pathname)
def changed(self, event=None, state=None, ts=None): if event is None: event = 'create' if state is None: state = 'new' if ts is None: ts = secs2utcdatetime() # now self.state = state self.event = event self.ts = ts