From 67515a89cad2f1e8758fa35f30b69d8308c27bb5 Mon Sep 17 00:00:00 2001 From: Seblu <sebastien.luttringer@smartjog.com> Date: Fri, 26 Aug 2011 10:33:01 +0200 Subject: [PATCH] use istools.isfile instead of istools.pathtype == "file" --- installsystems/database.py | 4 ++-- installsystems/image.py | 4 ++-- installsystems/repository.py | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/installsystems/database.py b/installsystems/database.py index 8bb13b2..bd28df3 100644 --- a/installsystems/database.py +++ b/installsystems/database.py @@ -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) diff --git a/installsystems/image.py b/installsystems/image.py index dcebb71..8c8a511 100644 --- a/installsystems/image.py +++ b/installsystems/image.py @@ -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 diff --git a/installsystems/repository.py b/installsystems/repository.py index 2539c6d..f250b85 100644 --- a/installsystems/repository.py +++ b/installsystems/repository.py @@ -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) -- GitLab