Remove Django 2.2 file

This commit is contained in:
int-y1 2023-01-11 03:15:45 -05:00 committed by Tudor Brindus
parent 69d5907631
commit 3914dec21c
5 changed files with 0 additions and 28 deletions

View File

@ -1,17 +0,0 @@
import django
from django.utils.encoding import force_str
if (2, 2) <= django.VERSION < (3,):
# Django 2.2.x is incompatible with PyMySQL.
# This monkey patch backports the Django 3.0+ code.
from django.db.backends.mysql.operations import DatabaseOperations
def last_executed_query(self, cursor, sql, params):
# With MySQLdb, cursor objects have an (undocumented) "_executed"
# attribute where the exact query sent to the database is saved.
# See MySQLdb/cursors.py in the source distribution.
# MySQLdb returns string, PyMySQL bytes.
return force_str(getattr(cursor, '_executed', None), errors='replace')
DatabaseOperations.last_executed_query = last_executed_query

View File

@ -9,6 +9,4 @@ gevent.monkey.patch_all()
import dmoj_install_pymysql # noqa: E402, F401, I100, I202, imported for side effect
from django.core.wsgi import get_wsgi_application # noqa: E402, I100, I202, django must be imported here
# noinspection PyUnresolvedReferences
import django_2_2_pymysql_patch # noqa: E402, I100, F401, I202, imported for side effect
application = get_wsgi_application()

View File

@ -11,9 +11,6 @@ import dmoj_install_pymysql # noqa: E402, F401, I100, I202, imported for side e
import django # noqa: E402, F401, I100, I202, django must be imported here
django.setup()
# noinspection PyUnresolvedReferences
import django_2_2_pymysql_patch # noqa: E402, I100, F401, I202, imported for side effect
from judge.bridge.daemon import judge_daemon # noqa: E402, I100, I202, django code must be imported here
if __name__ == '__main__':

View File

@ -8,8 +8,5 @@ except ImportError:
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'dmoj.settings')
# noinspection PyUnresolvedReferences
import django_2_2_pymysql_patch # noqa: E402, I100, F401, I202, imported for side effect
# noinspection PyUnresolvedReferences
from dmoj.celery import app # noqa: E402, F401, imported for side effect

View File

@ -11,7 +11,4 @@ if __name__ == '__main__':
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'dmoj.settings')
from django.core.management import execute_from_command_line
# noinspection PyUnresolvedReferences
import django_2_2_pymysql_patch # noqa: F401, imported for side effect
execute_from_command_line(sys.argv)