29 lines
674 B
Python
29 lines
674 B
Python
from izzylib_sql import Database, Session
|
|
|
|
|
|
row_classes = {}
|
|
|
|
|
|
def register_row(table):
|
|
def wrapper(cls):
|
|
row_classes[table] = cls
|
|
return cls
|
|
|
|
|
|
class CookieSession(Session):
|
|
def get_domain(self, domain):
|
|
return self.execute(f"SELECT * FROM moz_cookies WHERE host LIKE '%{domain}' or host = '.{domain}'")
|
|
|
|
|
|
def get_host(self, host):
|
|
#return self.execute(f"SELECT * FROM moz_cookies WHERE host LIKE '%{host}' or host = '{host}'")
|
|
return self.execute(f"SELECT * FROM moz_cookies WHERE host == '{host}' or host == '.{host}'")
|
|
|
|
|
|
def get_cookie_db(app):
|
|
return Database(
|
|
database = app.path.cookies,
|
|
session_class = CookieSession,
|
|
row_classes = row_classes
|
|
)
|