Remove old unused code.
This commit is contained in:
parent
098c772da9
commit
6e4cccb5f6
1 changed files with 0 additions and 19 deletions
|
@ -5,7 +5,6 @@ model.
|
|||
|
||||
from nturl2path import pathname2url as ntpathname2url
|
||||
from nturl2path import url2pathname as url2ntpathname
|
||||
import random
|
||||
import re
|
||||
import string
|
||||
from unicodedata import normalize
|
||||
|
@ -13,7 +12,6 @@ from urllib.parse import urljoin, urlparse
|
|||
from urllib.request import pathname2url, url2pathname
|
||||
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.db import connection
|
||||
from django.utils.encoding import iri_to_uri, uri_to_iri
|
||||
|
||||
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):
|
||||
'''Helper function to get dynamic settings from the database.'''
|
||||
setting = Setting.objects.get(name=name)
|
||||
|
|
Loading…
Reference in a new issue