diff --git a/sentry/eventtypes/base.py b/sentry/eventtypes/base.py index afab525..7ff7226 100644 --- a/sentry/eventtypes/base.py +++ b/sentry/eventtypes/base.py @@ -1,5 +1,6 @@ from sentry.utils.safe import get_path -from sentry.utils.strings import strip, truncatechars +from sentry.utils.strings import strip +from django.template.defaultfilters import truncatechars class DefaultEvent: diff --git a/sentry/eventtypes/error.py b/sentry/eventtypes/error.py index 9b2eecc..5335add 100644 --- a/sentry/eventtypes/error.py +++ b/sentry/eventtypes/error.py @@ -1,6 +1,8 @@ +from django.template.defaultfilters import truncatechars + from sentry.stacktraces.functions import get_function_name_for_frame from sentry.stacktraces.processing import get_crash_frame_from_event_data -from sentry.utils.safe import get_path, trim, truncatechars +from sentry.utils.safe import get_path, trim def get_crash_location(data): diff --git a/sentry/utils/safe.py b/sentry/utils/safe.py index 5b15721..5cf0021 100644 --- a/sentry/utils/safe.py +++ b/sentry/utils/safe.py @@ -2,8 +2,8 @@ import collections import json from django.utils.encoding import force_str +from django.template.defaultfilters import truncatechars -from sentry.utils.strings import truncatechars SENTRY_MAX_VARIABLE_SIZE = 512 diff --git a/sentry/utils/strings.py b/sentry/utils/strings.py index 3960aeb..748d002 100644 --- a/sentry/utils/strings.py +++ b/sentry/utils/strings.py @@ -1,11 +1,6 @@ from django.utils.encoding import smart_str -def truncatechars(value: str, chars=100): - """Truncate string and append …""" - return (value[:chars] + "…") if len(value) > chars else value - - def strip(value): if not value: return ""