예제 #1
0
파일: repo_mgr.py 프로젝트: vlkv/reggata
    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)
예제 #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)
예제 #3
0
def isSendStatisticsAllowed():
    sendStatistics = UserConfig().get("send_statistics")
    return hlp.stringToBool(sendStatistics)
예제 #4
0
def isSendStatisticsAllowed():
    sendStatistics = UserConfig().get("send_statistics")
    return hlp.stringToBool(sendStatistics)