truncatechars: just use the Django version

This commit is contained in:
Klaas van Schelven
2024-04-08 14:16:56 +02:00
parent 48307daa0f
commit 77209bde5d
4 changed files with 6 additions and 8 deletions

View File

@@ -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:

View File

@@ -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):

View File

@@ -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

View File

@@ -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 ""