Merged in bugfix/HTTPASTE-33 (pull request #20)

Bugfix/HTTPASTE-33
This commit is contained in:
Tiara Rodney 2022-04-03 02:06:04 +00:00
commit ea03dc1018
4 changed files with 8 additions and 5 deletions

View file

@ -60,7 +60,7 @@ class MySQL(Backend):
def __init__(self, parameters: MySQLParameters):
parameters = MySQLParameters(*parameters[1:], get_mysql_connection(parameters))
#parameters = MySQLParameters(*parameters[1:], get_mysql_connection(parameters))
self.user = MySQLUser(parameters, User)
self.paste = MySQLPaste(parameters, Paste)

View file

@ -35,7 +35,7 @@ class User(object):
self.model_class = model_class
self.connection = get_connection(parameters)
self.connection = get_connection(parameters, connect)
def load(self, proto: object) -> object:
@ -112,7 +112,7 @@ def get_mysql_connect_callee() -> object:
return connect
def get_connection(parameters: Parameters, connect_callee: Callable) -> object:
def get_connection(parameters: Parameters, connect: Callable) -> object:
"""get a mysql.connection.MySQLConnection object
"""

View file

@ -1,5 +1,7 @@
from os import path
from time import time
from importlib.resources import open_text
try:
from mysql.connector.connection import MySQLConnection
@ -92,7 +94,7 @@ def init(connection: MySQLConnection):
cursor = connection.cursor()
with open(path.join(path.dirname(__file__), 'paste.sql'), 'r') as fh:
with open_text('httpaste.backend.mysql', 'paste.sql') as fh:
cursor.execute(fh.read())

View file

@ -1,4 +1,5 @@
from os import path
from importlib.resources import open_text
try:
from mysql.connector.connection import MySQLConnection
except ImportError as e:
@ -83,7 +84,7 @@ def init(connection: MySQLConnection):
cursor = connection.cursor()
with open(path.join(path.dirname(__file__), 'user.sql'), 'r') as fh:
with open_text('httpaste.backend.mysql', 'user.sql') as fh:
cursor.execute(fh.read())