Exemple #1
0
def Make_Directory(Plugin_Name):
    Today = Common.Date(Full_Timestamp=True)
    Year = str(Today.year)
    Month = str(Today.month)
    Day = str(Today.day)

    if len(Month) == 1:
        Month = f"0{Month}"

    if len(Day) == 1:
        Day = f"0{Day}"

    File_Path = os.path.dirname(os.path.realpath('__file__'))
    Directory = f"{File_Path}/static/protected/output/{Plugin_Name}/{Year}/{Month}/{Day}"

    if not os.path.isdir(Directory):
        os.makedirs(Directory)
        logging.info(
            f"{Common.Date()} - General Library - Using new directory: {Directory}."
        )

    else:
        logging.info(
            f"{Common.Date()} - General Library - Using existing directory: {Directory}."
        )

    return Directory
Exemple #2
0
    def Create_Event(self, Description):

        try:
            self.Cursor.execute(
                "INSERT INTO events (description, created_at) VALUES (%s,%s)",
                (Description, Common.Date()))
            self.Connection.commit()

        except Exception as e:
            logging.error(f"{Common.Date()} - General Library - {str(e)}.")