Exemple #1
0
 def getProperty(self, respath, propertyname, propertyns):
    if propertyns == 'DAV:':
       isfile = fs.isfile(respath)
       if propertyname == 'creationdate':
           statresults = fs.stat(respath)
           return httpdatehelper.rfc3339(statresults.st_ctime)
       elif propertyname == 'getcontenttype':
           return self.getContentType(respath)
       elif propertyname == 'resourcetype':
          if fs.isdir(respath):
             return '<D:collection />'
          else:
             return ''
       elif propertyname == 'getlastmodified':
          statresults = fs.stat(respath)
          return httpdatehelper.getstrftime(statresults.st_mtime)
       elif propertyname == 'getcontentlength':
          if isfile:
             statresults = fs.stat(respath)
             return str(statresults.st_size)
          else:
              return '0'
          raise HTTPRequestException(processrequesterrorhandler.HTTP_NOT_FOUND)        
       elif propertyname == 'getetag':
          return self.getEntityTag(respath)
    raise HTTPRequestException(processrequesterrorhandler.HTTP_NOT_FOUND)
def get_backup_file_list(monitoring_dir, ELAPSED_TIME):
    backup_file_list = []
    now = int(time.time())
    for f in fs.find('*', path=monitoring_dir):
        last_accessed = fs.stat(f).st_atime
        diff = now - last_accessed
        if diff > ELAPSED_TIME:
            backup_file_list.append(f)
    return backup_file_list
def get_backup_dir_list(monitoring_dir, ELAPSED_TIME):
    backup_dir_list = []
    now = int(time.time())
    for f in fs.find('*', path=monitoring_dir):
        last_accessed = fs.stat(f).st_atime
        diff = now - last_accessed
        if diff > ELAPSED_TIME:
            if not fs.dirname(f) in backup_dir_list:
                backup_dir_list.append(fs.dirname(f))
    return list(set(backup_dir_list))
Exemple #4
0
 def getEntityTag(self, respath):
    if not fs.isfile(respath):
       return '"' + md5.new(respath).hexdigest() +'"'
    statresults = fs.stat(respath)
    return md5.new(respath).hexdigest() + '-' + str(statresults.st_mtime) + '-' + str(statresults.st_size)
Exemple #5
0
 def getContentLength(self, respath):
    if not fs.isfile(respath):
       return 0
    else:
       statresults = fs.stat(respath)
       return statresults.st_size
Exemple #6
0
 def getLastModified(self, respath):
       statresults = fs.stat(respath)
       return statresults.st_mtime