Commit 67515a89 authored by Seblu's avatar Seblu
Browse files

use istools.isfile instead of istools.pathtype == "file"

parent ee0d1190
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ class Database(object):
    def create(cls, path):
        arrow("Creating repository database")
        # check locality
        if istools.pathtype(path) != "file":
        if not istools.isfile(path):
            raise Exception("Database creation must be local")
        path = os.path.abspath(path)
        if os.path.exists(path):
@@ -42,7 +42,7 @@ class Database(object):

    def __init__(self, path):
        # check locality
        if istools.pathtype(path) != "file":
        if not istools.isfile(path):
            raise Exception("Database must be local")
        self.path = os.path.abspath(path)
        self.conn = sqlite3.connect(self.path, isolation_level=None)
+2 −2
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ class SourceImage(Image):
        Create an empty source image
        '''
        # check local repository
        if istools.pathtype(path) != "file":
        if not istools.isfile(path):
            raise NotImplementedError("SourceImage must be local")
        # main path
        parser_path = os.path.join(path, "parser")
@@ -100,7 +100,7 @@ class SourceImage(Image):

    def __init__(self, path):
        # check local repository
        if istools.pathtype(path) != "file":
        if not istools.isfile(path):
            raise NotImplementedError("SourceImage must be local")
        Image.__init__(self)
        self.base_path = path
+4 −4
Original line number Diff line number Diff line
@@ -82,7 +82,7 @@ class Repository(object):
        Update last file to current time
        '''
        # check local repository
        if istools.pathtype(self.config.path) != "file":
        if not istools.isfile(self.config.path):
            raise Exception("Repository addition must be local")
        try:
            arrow("Updating last file")
@@ -109,7 +109,7 @@ class Repository(object):
        if delete is true, remove original files
        '''
        # check local repository
        if istools.pathtype(self.config.path) != "file":
        if not istools.isfile(self.config.path):
            raise Exception("Repository addition must be local")
        # cannot add already existant image
        if self.has(image.name, image.version):
@@ -174,7 +174,7 @@ class Repository(object):
        Delete an image from repository
        '''
        # check local repository
        if istools.pathtype(self.config.path) != "file":
        if not istools.isfile(self.config.path):
            raise Exception("Repository deletion must be local")
        # get md5 of files related to images (exception is raised if not exists
        md5s = self.getmd5(name, version)
@@ -375,7 +375,7 @@ class RepositoryConfig(object):
        Set db path
        '''
        # dbpath must be local, sqlite3 requirment
        if istools.pathtype(value) != "file":
        if not istools.isfile(value):
            raise ValueError("Database path must be local")
        self._dbpath = os.path.abspath(value)