|
@@ -22,12 +22,12 @@ from azure.abfs.__init__ import strip_path, abfsdatetime_to_timestamp
|
|
|
from django.utils.encoding import smart_str
|
|
from django.utils.encoding import smart_str
|
|
|
|
|
|
|
|
LOG = logging.getLogger(__name__)
|
|
LOG = logging.getLogger(__name__)
|
|
|
-CHAR_TO_OCT = {"---": 0, "--x" : 1, "-w-": 2, "-wx": 3, "r--" : 4, "r-x" : 5, "rw-" : 6,"rwx": 7}
|
|
|
|
|
|
|
+CHAR_TO_OCT = {"---": 0, "--x": 1, "-w-": 2, "-wx": 3, "r--": 4, "r-x": 5, "rw-": 6, "rwx": 7}
|
|
|
|
|
|
|
|
|
|
|
|
|
class ABFSStat(object):
|
|
class ABFSStat(object):
|
|
|
|
|
|
|
|
- def __init__(self, isDir, atime, mtime, size, path, owner = '', group = '', mode = None):
|
|
|
|
|
|
|
+ def __init__(self, isDir, atime, mtime, size, path, owner='', group='', mode=None):
|
|
|
self.name = strip_path(path)
|
|
self.name = strip_path(path)
|
|
|
self.path = path
|
|
self.path = path
|
|
|
self.isDir = isDir
|
|
self.isDir = isDir
|
|
@@ -65,15 +65,15 @@ class ABFSStat(object):
|
|
|
return False
|
|
return False
|
|
|
|
|
|
|
|
@classmethod
|
|
@classmethod
|
|
|
- def for_root(cls,path):
|
|
|
|
|
|
|
+ def for_root(cls, path):
|
|
|
return cls(True, 0, 0, 0, path)
|
|
return cls(True, 0, 0, 0, path)
|
|
|
|
|
|
|
|
@classmethod
|
|
@classmethod
|
|
|
- def for_filesystems(cls,headers,resp, scheme):
|
|
|
|
|
|
|
+ def for_filesystems(cls, headers, resp, scheme):
|
|
|
return cls(True, headers['date'], resp['lastModified'], 0, scheme + resp['name'])
|
|
return cls(True, headers['date'], resp['lastModified'], 0, scheme + resp['name'])
|
|
|
|
|
|
|
|
@classmethod
|
|
@classmethod
|
|
|
- def for_directory(cls,headers,resp, path):
|
|
|
|
|
|
|
+ def for_directory(cls, headers, resp, path):
|
|
|
try:
|
|
try:
|
|
|
size = int(resp['contentLength'])
|
|
size = int(resp['contentLength'])
|
|
|
except:
|
|
except:
|
|
@@ -86,17 +86,17 @@ class ABFSStat(object):
|
|
|
permissions = ABFSStat.char_permissions_to_oct_permissions(resp['permissions'])
|
|
permissions = ABFSStat.char_permissions_to_oct_permissions(resp['permissions'])
|
|
|
except:
|
|
except:
|
|
|
permissions = None
|
|
permissions = None
|
|
|
- return cls(isDir, headers['date'], resp['lastModified'], size, path, resp.get('owner'), resp.get('group'), mode = permissions)
|
|
|
|
|
|
|
+ return cls(isDir, headers['date'], resp.get('lastModified'), size, path, resp.get('owner'), resp.get('group'), mode=permissions)
|
|
|
|
|
|
|
|
@classmethod
|
|
@classmethod
|
|
|
- def for_single(cls,resp, path):
|
|
|
|
|
|
|
+ def for_single(cls, resp, path):
|
|
|
size = int(resp['Content-Length'])
|
|
size = int(resp['Content-Length'])
|
|
|
isDir = resp['x-ms-resource-type'] == 'directory'
|
|
isDir = resp['x-ms-resource-type'] == 'directory'
|
|
|
try:
|
|
try:
|
|
|
permissions = ABFSStat.char_permissions_to_oct_permissions(resp['x-ms-permissions'])
|
|
permissions = ABFSStat.char_permissions_to_oct_permissions(resp['x-ms-permissions'])
|
|
|
except:
|
|
except:
|
|
|
permissions = None
|
|
permissions = None
|
|
|
- return cls(isDir, resp['date'],resp['Last-Modified'], size, path, resp.get('x-ms-owner'), resp.get('x-ms-group'), mode = permissions)
|
|
|
|
|
|
|
+ return cls(isDir, resp['date'], resp['Last-Modified'], size, path, resp.get('x-ms-owner'), resp.get('x-ms-group'), mode=permissions)
|
|
|
|
|
|
|
|
@classmethod
|
|
@classmethod
|
|
|
def for_filesystem(cls, resp, path):
|
|
def for_filesystem(cls, resp, path):
|