python3 only: remove six.moves imports
This commit is contained in:
parent
844382b1e8
commit
548a73f121
33 changed files with 75 additions and 121 deletions
|
|
@ -1,7 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import unicodedata
|
||||
|
||||
from six import string_types
|
||||
from django.db.models import Q, Manager
|
||||
from django.conf import settings
|
||||
|
||||
|
|
@ -152,7 +151,7 @@ def buildCondition(k, op, v, user, exclude=False, owner=None):
|
|||
value_key = 'find__value'
|
||||
else:
|
||||
value_key = k
|
||||
if isinstance(v, string_types):
|
||||
if isinstance(v, str):
|
||||
v = unicodedata.normalize('NFKD', v).lower()
|
||||
if k in facet_keys:
|
||||
in_find = False
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from glob import glob
|
||||
from urllib.parse import quote, unquote
|
||||
import os
|
||||
import re
|
||||
from glob import glob
|
||||
import unicodedata
|
||||
|
||||
from six import PY2, string_types
|
||||
from six.moves.urllib.parse import quote, unquote
|
||||
from django.db import models, transaction
|
||||
from django.db.models import Q, Sum, Max
|
||||
from django.contrib.auth import get_user_model
|
||||
|
|
@ -34,9 +33,6 @@ from .fulltext import FulltextMixin
|
|||
|
||||
User = get_user_model()
|
||||
|
||||
if not PY2:
|
||||
unicode = str
|
||||
|
||||
def get_path(f, x):
|
||||
return f.path(x)
|
||||
|
||||
|
|
@ -88,7 +84,7 @@ class Document(models.Model, FulltextMixin):
|
|||
if not current_values:
|
||||
current_values = []
|
||||
else:
|
||||
current_values = [unicode(current_values)]
|
||||
current_values = [str(current_values)]
|
||||
|
||||
filter_map = utils.get_by_id(settings.CONFIG['documentKeys'], key).get('filterMap')
|
||||
if filter_map:
|
||||
|
|
@ -139,7 +135,7 @@ class Document(models.Model, FulltextMixin):
|
|||
f, created = Find.objects.get_or_create(document=self, key=key)
|
||||
if isinstance(value, bool):
|
||||
value = value and 'true' or 'false'
|
||||
if isinstance(value, string_types):
|
||||
if isinstance(value, str):
|
||||
value = ox.decode_html(ox.strip_tags(value.strip()))
|
||||
value = unicodedata.normalize('NFKD', value).lower()
|
||||
f.value = value
|
||||
|
|
@ -197,7 +193,7 @@ class Document(models.Model, FulltextMixin):
|
|||
return sort_value.lower()
|
||||
|
||||
def set_value(s, name, value):
|
||||
if isinstance(value, string_types):
|
||||
if isinstance(value, str):
|
||||
value = ox.decode_html(value.lower())
|
||||
if not value:
|
||||
value = None
|
||||
|
|
@ -259,7 +255,7 @@ class Document(models.Model, FulltextMixin):
|
|||
set_value(s, name, value)
|
||||
elif sort_type == 'date':
|
||||
value = self.get_value(source)
|
||||
if isinstance(value, string_types):
|
||||
if isinstance(value, str):
|
||||
value = datetime_safe.datetime.strptime(value, '%Y-%m-%d')
|
||||
set_value(s, name, value)
|
||||
s.save()
|
||||
|
|
@ -370,11 +366,11 @@ class Document(models.Model, FulltextMixin):
|
|||
self.data[key] = [ox.sanitize_html(t) for t in data[key]]
|
||||
elif ktype == '[string]':
|
||||
self.data[key] = [ox.escape_html(t) for t in data[key]]
|
||||
elif isinstance(data[key], string_types):
|
||||
elif isinstance(data[key], str):
|
||||
self.data[key] = ox.escape_html(data[key])
|
||||
elif isinstance(data[key], list):
|
||||
def cleanup(i):
|
||||
if isinstance(i, string_types):
|
||||
if isinstance(i, str):
|
||||
i = ox.escape_html(i)
|
||||
return i
|
||||
self.data[key] = [cleanup(i) for i in data[key]]
|
||||
|
|
@ -480,7 +476,7 @@ class Document(models.Model, FulltextMixin):
|
|||
if self.extension == 'html':
|
||||
response['text'] = self.data.get('text', '')
|
||||
if item:
|
||||
if isinstance(item, string_types):
|
||||
if isinstance(item, str):
|
||||
item = Item.objects.get(public_id=item)
|
||||
d = self.descriptions.filter(item=item)
|
||||
if d.exists():
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import re
|
|||
from glob import glob
|
||||
import unicodedata
|
||||
|
||||
from six import string_types
|
||||
import ox
|
||||
from ox.utils import json
|
||||
from oxdjango.api import actions
|
||||
|
|
@ -70,7 +69,7 @@ def addDocument(request, data):
|
|||
else:
|
||||
ids = [data['id']]
|
||||
if 'item' in data:
|
||||
if isinstance(data['item'], string_types):
|
||||
if isinstance(data['item'], str):
|
||||
item = Item.objects.get(public_id=data['item'])
|
||||
if item.editable(request.user):
|
||||
for id in ids:
|
||||
|
|
@ -87,7 +86,7 @@ def addDocument(request, data):
|
|||
document.add(item)
|
||||
add_changelog(request, data, data['item'])
|
||||
elif 'entity' in data:
|
||||
if isinstance(data['entity'], string_types):
|
||||
if isinstance(data['entity'], str):
|
||||
entity = Entity.get(data['entity'])
|
||||
if entity.editable(request.user):
|
||||
for id in ids:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue