python3 only: remove six.moves imports
This commit is contained in:
parent
844382b1e8
commit
548a73f121
33 changed files with 75 additions and 121 deletions
|
|
@ -4,7 +4,6 @@ from __future__ import division, absolute_import
|
|||
import inspect
|
||||
import sys
|
||||
|
||||
from six import PY2
|
||||
from django.conf import settings
|
||||
|
||||
from ..shortcuts import render_to_json_response, json_response
|
||||
|
|
@ -109,12 +108,8 @@ class ApiActions(dict):
|
|||
if name != 'api' and hasattr(f, 'func_closure') and f.func_closure:
|
||||
fc = list(filter(lambda c: hasattr(c.cell_contents, '__call__'), f.func_closure))
|
||||
f = fc[len(fc)-1].cell_contents
|
||||
if PY2:
|
||||
info = f.func_code.co_filename[len(settings.PROJECT_ROOT)+1:]
|
||||
info = '%s:%s' % (info, f.func_code.co_firstlineno)
|
||||
else:
|
||||
info = f.__code__.co_filename[len(settings.PROJECT_ROOT)+1:]
|
||||
info = '%s:%s' % (info, f.__code__.co_firstlineno)
|
||||
info = f.__code__.co_filename[len(settings.PROJECT_ROOT)+1:]
|
||||
info = '%s:%s' % (info, f.__code__.co_firstlineno)
|
||||
return info, trim(inspect.getsource(f))
|
||||
|
||||
def register(self, method, action=None, cache=True, version=None):
|
||||
|
|
|
|||
|
|
@ -8,8 +8,6 @@ from django.utils import datetime_safe
|
|||
import django.contrib.postgres.fields
|
||||
from django.core.serializers.json import DjangoJSONEncoder
|
||||
|
||||
from six import string_types
|
||||
|
||||
from ox.utils import json
|
||||
|
||||
class JSONField(django.contrib.postgres.fields.JSONField):
|
||||
|
|
@ -74,7 +72,7 @@ class DictField(models.TextField):
|
|||
except:
|
||||
raise Exception('failed to parse value: %s' % value)
|
||||
if value is not None:
|
||||
if isinstance(value, string_types):
|
||||
if isinstance(value, str):
|
||||
value = json.loads(value)
|
||||
assert isinstance(value, self._type)
|
||||
return value
|
||||
|
|
@ -83,7 +81,7 @@ class DictField(models.TextField):
|
|||
if isinstance(value, self._type):
|
||||
value = self.dumps(value)
|
||||
if value is not None:
|
||||
assert isinstance(value, string_types)
|
||||
assert isinstance(value, str)
|
||||
value = models.TextField.get_prep_value(self, value)
|
||||
return value
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import os
|
||||
import mimetypes
|
||||
from datetime import datetime, timedelta
|
||||
from six.moves.urllib.parse import quote
|
||||
from urllib.parse import quote
|
||||
import mimetypes
|
||||
import os
|
||||
|
||||
from django.http import HttpResponse, Http404
|
||||
from django.conf import settings
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue