Пример #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)
Пример #2
0
 def getResourceDescription(self, respath):
    if fs.isdir(respath):
       return "Directory"
    elif fs.isfile(respath):
       return "File"
    else:
       return "Unknown"
Пример #3
0
 def getResourceDescriptor(self, respath):
    resdesc = self.getResourceDescription(respath)
    ressize = str(self.getContentLength(respath)) + " B"
    resmod = httpdatehelper.getstrftime(self.getLastModified(respath))
    if fs.isdir(respath):
       ressize = ""
    return [resdesc, ressize, resmod]
Пример #4
0
 def getDir(self):
     print('Input directory')
     path = input('>>>')
     if(fs.isdir(path)):
         self.path = path
     else:
         print('Please input a valid directory !')
         exit()
Пример #5
0
def test_isdir_on_non_existing_file():
    assert fs.isdir(os.path.join(TEST_DIR, "foo.txt")) is False
Пример #6
0
def test_isdir_on_existing_file():
    assert fs.isdir(TEST_FILE) is False
Пример #7
0
def test_isdir_on_non_existing_directory():
    assert fs.isdir(os.path.join(TEST_DIR, "foo")) is False
Пример #8
0
def test_isdir_on_existing_directory():
    assert fs.isdir(TEST_DIR) is True
Пример #9
0
fs.close(fa1)
fs.chdir('/a')
print fs.listdir('.')

#this is just to test if it could delte directory with file consisted inside
#not enough space in native file to create this  file, if not some file are delete.
fs.create('b2/fb2', 70)
fb2d = fs.open('b2/fb2', 'w')
fs.write(fb2d, 'this is to test if we \n could delete anythin inthe directory')
fs.close(fb2d)
fb21 = fs.open('b2/fb2', 'r')
print fs.readlines(fb21)
fs.close(fb21)
fs.deldir('b2')

print fs.isdir('/a/b1/c2')
print fs.isdir('/a/b3/fc')

#print fs.open('b2/fb2', 'r')
print fs.listdir('.')


def printAll(root):
    print "Current Directory is " + root.dirName
    print list(map(prn, root.contentList))
    for i in root.contentList:
        if isinstance(i, fs.Directory):
            printAll(i)


def printAllFiles(root):
Пример #10
0
 def isCollection(self, respath):
    return fs.isdir(respath)
Пример #11
0
def clean():
	"""Clean the dist/ directory"""
	if (fs.isdir(DIST_DIR)):
		fs.truncate(DIST_DIR)
Пример #12
0
def test_isdir_on_existing_file():
    assert fs.isdir(TEST_FILE) is False
Пример #13
0
def test_isdir_on_non_existing_directory():
    assert fs.isdir(os.path.join(TEST_DIR, "foo")) is False
Пример #14
0
def test_isdir_on_existing_directory():
    assert fs.isdir(TEST_DIR) is True
Пример #15
0
def test_isdir_on_non_existing_file():
    assert fs.isdir(os.path.join(TEST_DIR, "foo.txt")) is False