Remove old unused code.

This commit is contained in:
Josh W 2020-02-15 18:12:25 -05:00
parent 098c772da9
commit 6e4cccb5f6

View file

@ -5,7 +5,6 @@ model.
from nturl2path import pathname2url as ntpathname2url from nturl2path import pathname2url as ntpathname2url
from nturl2path import url2pathname as url2ntpathname from nturl2path import url2pathname as url2ntpathname
import random
import re import re
import string import string
from unicodedata import normalize from unicodedata import normalize
@ -13,7 +12,6 @@ from urllib.parse import urljoin, urlparse
from urllib.request import pathname2url, url2pathname from urllib.request import pathname2url, url2pathname
from django.core.exceptions import ObjectDoesNotExist from django.core.exceptions import ObjectDoesNotExist
from django.db import connection
from django.utils.encoding import iri_to_uri, uri_to_iri from django.utils.encoding import iri_to_uri, uri_to_iri
from .models import Setting from .models import Setting
@ -36,23 +34,6 @@ FILE_IRI_PATTERN = (
) )
def get_len(rawqueryset):
'''
Adds/Overrides a dynamic implementation of the length protocol to the
definition of RawQuerySet.
'''
def __len__(self):
params = ['{}'.format(p) for p in self.params]
sql = ''.join(('SELECT COUNT(*) FROM (',
rawqueryset.raw_query.format(tuple(params)),
') B;'))
cursor = connection.cursor()
cursor.execute(sql)
row = cursor.fetchone()
return row[0]
return __len__
def get_setting(name): def get_setting(name):
'''Helper function to get dynamic settings from the database.''' '''Helper function to get dynamic settings from the database.'''
setting = Setting.objects.get(name=name) setting = Setting.objects.get(name=name)