Beispiel #1
0
    def __init__(self, path_to_repo):
        """
            Opens an existing repository at given path.
        """
        try:
            self._base_path = path_to_repo
            if not os.path.exists(self.base_path + os.sep + consts.METADATA_DIR):
                raise Exception("Directory {} is not a repository base path.".format(self.base_path))

            engine_echo = stringToBool(UserConfig().get("sqlalchemy.engine_echo"))

            self.__engine = sqa.create_engine(
                "sqlite:///" + self.base_path + os.sep + consts.METADATA_DIR + os.sep + consts.DB_FILE, echo=engine_echo
            )

            self.Session = sessionmaker(bind=self.__engine)
        except Exception as ex:
            raise CannotOpenRepoError(ex)
Beispiel #2
0
    def __init__(self, path_to_repo):
        '''
            Opens an existing repository at given path.
        '''
        try:
            self._base_path = path_to_repo
            if not os.path.exists(self.base_path + os.sep + consts.METADATA_DIR):
                raise Exception("Directory {} is not a repository base path."
                                .format(self.base_path))

            engine_echo = stringToBool(UserConfig().get("sqlalchemy.engine_echo"))

            self.__engine = sqa.create_engine(\
                "sqlite:///" + self.base_path + os.sep + consts.METADATA_DIR + os.sep + \
                consts.DB_FILE, echo=engine_echo)

            self.Session = sessionmaker(bind=self.__engine)
        except Exception as ex:
            raise CannotOpenRepoError(ex)
Beispiel #3
0
def isSendStatisticsAllowed():
    sendStatistics = UserConfig().get("send_statistics")
    return hlp.stringToBool(sendStatistics)
Beispiel #4
0
def isSendStatisticsAllowed():
    sendStatistics = UserConfig().get("send_statistics")
    return hlp.stringToBool(sendStatistics)