Merge "Remove six.reraise usage"
This commit is contained in:
commit
8e83422edd
@ -20,8 +20,6 @@ import logging
|
||||
import os
|
||||
import sys
|
||||
|
||||
import six
|
||||
|
||||
from debtcollector import removals
|
||||
from django.core.management import color_style
|
||||
from django.utils import encoding
|
||||
@ -345,4 +343,6 @@ def handle(request, message=None, redirect=None, ignore=False,
|
||||
if ret:
|
||||
return ret
|
||||
|
||||
six.reraise(exc_type, exc_value, exc_traceback)
|
||||
# NOTE: This function is intended to call inside an except clause.
|
||||
# pylint: disable=misplaced-bare-raise
|
||||
raise
|
||||
|
@ -36,7 +36,6 @@ from django.utils.http import urlencode
|
||||
from django.utils.safestring import mark_safe
|
||||
from django.utils import termcolors
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
import six
|
||||
|
||||
from horizon import conf
|
||||
from horizon import exceptions
|
||||
@ -830,11 +829,8 @@ class Cell(html.HTMLElement):
|
||||
data = self.column.empty_value(self.datum)
|
||||
else:
|
||||
data = self.column.empty_value
|
||||
except Exception:
|
||||
data = None
|
||||
exc_info = sys.exc_info()
|
||||
raise six.reraise(template.TemplateSyntaxError, exc_info[1],
|
||||
exc_info[2])
|
||||
except Exception as e:
|
||||
raise template.TemplateSyntaxError from e
|
||||
|
||||
if self.url and not self.column.auto == "form_field":
|
||||
link_attrs = ' '.join(['%s="%s"' % (k, v) for (k, v) in
|
||||
@ -1960,13 +1956,11 @@ class DataTable(object, metaclass=DataTableMetaclass):
|
||||
self.selected = True
|
||||
row.classes.append('current_selected')
|
||||
rows.append(row)
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
# Exceptions can be swallowed at the template level here,
|
||||
# re-raising as a TemplateSyntaxError makes them visible.
|
||||
LOG.exception("Error while rendering table rows.")
|
||||
exc_info = sys.exc_info()
|
||||
raise six.reraise(template.TemplateSyntaxError, exc_info[1],
|
||||
exc_info[2])
|
||||
raise template.TemplateSyntaxError from e
|
||||
|
||||
return rows
|
||||
|
||||
|
@ -13,9 +13,6 @@
|
||||
import collections
|
||||
import itertools
|
||||
import logging
|
||||
import sys
|
||||
|
||||
import six
|
||||
|
||||
from django import template
|
||||
from django.template import loader
|
||||
@ -143,13 +140,11 @@ class FormsetDataTableMixin(object):
|
||||
self.selected = True
|
||||
row.classes.append('current_selected')
|
||||
rows.append(row)
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
# Exceptions can be swallowed at the template level here,
|
||||
# re-raising as a TemplateSyntaxError makes them visible.
|
||||
LOG.exception("Error while rendering table rows.")
|
||||
exc_info = sys.exc_info()
|
||||
raise six.reraise(template.TemplateSyntaxError, exc_info[1],
|
||||
exc_info[2])
|
||||
raise template.TemplateSyntaxError from e
|
||||
return rows
|
||||
|
||||
def get_object_id(self, datum):
|
||||
|
@ -15,9 +15,6 @@
|
||||
from collections import OrderedDict
|
||||
import logging
|
||||
import operator
|
||||
import sys
|
||||
|
||||
import six
|
||||
|
||||
from django.conf import settings
|
||||
from django.template.loader import render_to_string
|
||||
@ -370,9 +367,8 @@ class Tab(html.HTMLElement):
|
||||
context = self.data
|
||||
except exceptions.Http302:
|
||||
raise
|
||||
except Exception:
|
||||
exc_type, exc_value, exc_traceback = sys.exc_info()
|
||||
raise six.reraise(TemplateSyntaxError, exc_value, exc_traceback)
|
||||
except Exception as e:
|
||||
raise TemplateSyntaxError from e
|
||||
return render_to_string(self.get_template_name(self.request), context)
|
||||
|
||||
def get_id(self):
|
||||
|
@ -18,8 +18,6 @@ import ast
|
||||
import os
|
||||
import re
|
||||
|
||||
import six
|
||||
|
||||
from django.utils import encoding
|
||||
from django.utils import functional
|
||||
from django.utils.module_loading import import_string
|
||||
@ -110,7 +108,7 @@ class Literal(types.ConfigType):
|
||||
try:
|
||||
value = ast.literal_eval(value)
|
||||
except SyntaxError as e:
|
||||
six.raise_from(ValueError(e), e)
|
||||
raise ValueError from e
|
||||
self.validate(value, self.spec)
|
||||
return self.update(value, self.spec)
|
||||
|
||||
@ -205,7 +203,7 @@ class Importable(types.ConfigType):
|
||||
try:
|
||||
return import_string(value)
|
||||
except ImportError as e:
|
||||
six.raise_from(ValueError(e), e)
|
||||
raise ValueError from e
|
||||
|
||||
def _formatter(self, value):
|
||||
module = value.__module__
|
||||
|
@ -41,7 +41,6 @@ pytz>=2013.6 # MIT
|
||||
PyYAML>=3.12 # MIT
|
||||
requests>=2.14.2 # Apache-2.0
|
||||
semantic-version>=2.3.1 # BSD
|
||||
six>=1.10.0 # MIT
|
||||
XStatic>=1.0.0 # MIT License
|
||||
XStatic-Angular>=1.5.8.0 # MIT License
|
||||
XStatic-Angular-Bootstrap>=2.2.0.0 # MIT License
|
||||
|
Loading…
x
Reference in New Issue
Block a user