1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 08:21:15 +03:00

Remove some unused functions.

This commit is contained in:
Bill Nottingham 2019-02-13 16:29:59 -05:00
parent 631d3515f2
commit 0f54d30f2c

View File

@ -29,14 +29,14 @@ from django.db.models.query import QuerySet
from django.db.models import Q from django.db.models import Q
# Django REST Framework # Django REST Framework
from rest_framework.exceptions import ParseError, PermissionDenied from rest_framework.exceptions import ParseError
from django.utils.encoding import smart_str from django.utils.encoding import smart_str
from django.utils.text import slugify from django.utils.text import slugify
from django.apps import apps from django.apps import apps
logger = logging.getLogger('awx.main.utils') logger = logging.getLogger('awx.main.utils')
__all__ = ['get_object_or_400', 'get_object_or_403', 'camelcase_to_underscore', 'memoize', 'memoize_delete', __all__ = ['get_object_or_400', 'camelcase_to_underscore', 'memoize', 'memoize_delete',
'get_ansible_version', 'get_ssh_version', 'get_licenser', 'get_awx_version', 'update_scm_url', 'get_ansible_version', 'get_ssh_version', 'get_licenser', 'get_awx_version', 'update_scm_url',
'get_type_for_model', 'get_model_for_type', 'copy_model_by_class', 'region_sorting', 'get_type_for_model', 'get_model_for_type', 'copy_model_by_class', 'region_sorting',
'copy_m2m_relationships', 'prefetch_page_capabilities', 'to_python_boolean', 'copy_m2m_relationships', 'prefetch_page_capabilities', 'to_python_boolean',
@ -65,21 +65,6 @@ def get_object_or_400(klass, *args, **kwargs):
raise ParseError(*e.args) raise ParseError(*e.args)
def get_object_or_403(klass, *args, **kwargs):
'''
Return a single object from the given model or queryset based on the query
params, otherwise raise an exception that will return in a 403 response.
'''
from django.shortcuts import _get_queryset
queryset = _get_queryset(klass)
try:
return queryset.get(*args, **kwargs)
except queryset.model.DoesNotExist as e:
raise PermissionDenied(*e.args)
except queryset.model.MultipleObjectsReturned as e:
raise PermissionDenied(*e.args)
def to_python_boolean(value, allow_none=False): def to_python_boolean(value, allow_none=False):
value = str(value) value = str(value)
if value.lower() in ('true', '1', 't'): if value.lower() in ('true', '1', 't'):
@ -914,13 +899,6 @@ def timestamp_apiformat(timestamp):
return timestamp return timestamp
# damn you python 2.6
def timedelta_total_seconds(timedelta):
return (
timedelta.microseconds + 0.0 +
(timedelta.seconds + timedelta.days * 24 * 3600) * 10 ** 6) / 10 ** 6
class NoDefaultProvided(object): class NoDefaultProvided(object):
pass pass