melon/modules/user/home.py

36 lines
1.0 KiB
Python
Raw Permalink Normal View History

2022-08-17 15:09:08 +07:00
from mako.template import Template
import mysql.connector as mariadb
import config.database as database
import config.globalvar as globalvar
class main:
def __init__(self):
pass
def html(self, params):
interface_template = params["params_page"]['template' ]
topnav = params["params_page"]['topnav' ]
footer = params["params_page"]['footer' ]
container = params["params_page"]['container' ]
con = mariadb.connect(**database.main_db)
cursor = con.cursor()
cursor.execute("SELECT id, title, logo FROM portal")
listing_portal = cursor.fetchall()
con.close()
return Template(interface_template).render(
GV_title = globalvar.GV_title,
GV_base_url = globalvar.GV_base_url,
topnav = Template(topnav).render(
GV_title = globalvar.GV_title,
),
footer = Template(footer).render(),
container = Template(container).render(
GV_base_url = globalvar.GV_base_url,
listing_portal = listing_portal
)
)