Skip to content

Commit

Permalink
Merge pull request #764 from CDLUC3/develop
Browse files Browse the repository at this point in the history
Merge develop to main branch for fixing deprecated warnings
  • Loading branch information
jsjiang authored Oct 8, 2024
2 parents 3e95791 + 1f9f971 commit d48e634
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
16 changes: 13 additions & 3 deletions impl/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
"""
import os
import ast
import cgi
import datetime
import json
import logging
Expand Down Expand Up @@ -144,10 +143,21 @@ def _readInput(request):

def is_text_plain_utf8(request):
content_type = request.META.get('CONTENT_TYPE', '')
mimetype, options = cgi.parse_header(content_type)
mimetype = None
charset = None
if ';' in content_type:
[mimetype, charset] = content_type.split(';')
mimetype = mimetype.strip()
charset = charset.split('=')[1].strip()
else:
mimetype = content_type.strip()

print(mimetype)
print(charset)

if mimetype not in ('text/plain', ''):
return False
if options.get('charset', 'utf-8').lower() != 'utf-8':
if charset is not None and charset.lower() != 'utf-8':
return False
return True

Expand Down
4 changes: 2 additions & 2 deletions impl/form_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@
('Workflow', _('Workflow')),
('Other', _('Other')),
)
REGEX_4DIGITYEAR = '^(\d{4}|\(:unac\)|\(:unal\)|\(:unap\)|\(:unas\)|\(:unav\)|\
REGEX_4DIGITYEAR = r'^(\d{4}|\(:unac\)|\(:unal\)|\(:unap\)|\(:unas\)|\(:unav\)|\
\(:unkn\)|\(:none\)|\(:null\)|\(:tba\)|\(:etal\)|\(:at\))$'
REGEX_GEOPOINT = '-?(\d+(\.\d*)?|\.\d+)$'
REGEX_GEOPOINT = r'-?(\d+(\.\d*)?|\.\d+)$'
# http://stackoverflow.com/questions/3962543/how-can-i-validate-a-culture-code-with-a-regular-expression
REGEX_LANGUAGE = '^[a-z]{2,3}(?:-[A-Z]{2,3}(?:-[a-zA-Z]{4})?)?$'
ERR_4DIGITYEAR = _("Four digits required")
Expand Down
4 changes: 2 additions & 2 deletions ui_tags/templatetags/manage_form_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def column_choices(field_order, fields_mapped, fields_selected):

def make_check_tag(item, friendly_names, selected):
if item in selected:
checked_str = " checked='checked' "
checked_str = " checked='checked'"
else:
checked_str = ""
return (
Expand All @@ -42,7 +42,7 @@ def make_check_tag(item, friendly_names, selected):
+ django.utils.html.escape(item)
+ "' value='t'"
+ checked_str
+ " \> "
+ " /> "
+ "<label for='"
+ django.utils.html.escape(item)
+ "'>"
Expand Down

0 comments on commit d48e634

Please sign in to comment.