Fix conflicts for Django 4 support

This commit is contained in:
Garret Wassermann
2022-04-23 02:23:51 -04:00
27 changed files with 180 additions and 154 deletions

View File

@ -11,7 +11,7 @@ import mimetypes
from datetime import datetime, date, time
from django.conf import settings
from django.utils.encoding import smart_text
from django.utils.encoding import smart_str
from helpdesk.settings import CUSTOMFIELD_DATETIME_FORMAT, CUSTOMFIELD_DATE_FORMAT, CUSTOMFIELD_TIME_FORMAT
@ -117,13 +117,13 @@ def text_is_spam(text, request):
if ak.verify_key():
ak_data = {
'user_ip': request.META.get('REMOTE_ADDR', '127.0.0.1'),
'user_agent': request.META.get('HTTP_USER_AGENT', ''),
'referrer': request.META.get('HTTP_REFERER', ''),
'user_agent': request.headers.get('User-Agent', ''),
'referrer': request.headers.get('Referer', ''),
'comment_type': 'comment',
'comment_author': '',
}
return ak.comment_check(smart_text(text), data=ak_data)
return ak.comment_check(smart_str(text), data=ak_data)
return False
@ -135,8 +135,9 @@ def process_attachments(followup, attached_files):
for attached in attached_files:
if attached.size:
filename = smart_text(attached.name)
att = followup.followupattachment_set.create(
filename = smart_str(attached.name)
att = FollowUpAttachment(
followup=followup,
file=attached,
filename=filename,
mime_type=attached.content_type or