Пример #1
0
def get_content(type, folder):
    content = []
    conn = pymysql.connect(user=config.MYSQL_USER,
                           password=config.MYSQL_PASS,
                           db=config.MYSQL_DB,
                           host=config.MYSQL_HOST)
    with conn:
        cursor = conn.cursor()
        cursor.execute(f"select * from {type} where folder='{folder}'")
        content = cursor.fetchall()
    output = []
    if type.lower() == "docs":
        for item in content:
            output.append(
                items.Doc(value=item[1], user=item[2], folder=item[3]))

    elif type.lower() == "links":
        for item in content:
            output.append(
                items.Link(value=item[1], user=item[2], folder=item[3]))
    return output
Пример #2
0
 def do_link(self, **kwargs):
     """Add informational item to the minutes."""
     m = items.Link(M=self, **kwargs)
     self.additem(m)