This is an automated email from the ASF dual-hosted git repository. kentontaylor pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/allura.git
commit 6553767dcd908c6898b175ff42cd16be71eda146 Author: Dave Brondsema <[email protected]> AuthorDate: Fri Feb 21 16:47:57 2025 -0500 be explicit about our need for cgi.FieldStorage as long as webob is giving us them --- Allura/allura/model/discuss.py | 5 +++-- requirements.in | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Allura/allura/model/discuss.py b/Allura/allura/model/discuss.py index 35d07cc77..8fd99cfc7 100644 --- a/Allura/allura/model/discuss.py +++ b/Allura/allura/model/discuss.py @@ -17,6 +17,7 @@ from __future__ import annotations import os import logging +from cgi import FieldStorage from datetime import datetime import typing @@ -654,14 +655,14 @@ def subject(self): subject = getattr(artifact, 'email_subject', '') return subject or '(no subject)' - def add_multiple_attachments(self, file_info): + def add_multiple_attachments(self, file_info: FieldStorage | list[FieldStorage]): if isinstance(file_info, list): for fi in file_info: self.add_attachment(fi) else: self.add_attachment(file_info) - def add_attachment(self, file_info): + def add_attachment(self, file_info: FieldStorage): # webob provides attachments as FieldStorage via legacy-cgi if hasattr(file_info, 'file'): mime_type = file_info.type if not mime_type or '/' not in mime_type: diff --git a/requirements.in b/requirements.in index ebc66919b..0b48ae4be 100644 --- a/requirements.in +++ b/requirements.in @@ -15,6 +15,8 @@ FormEncode GitPython html5lib Jinja2 +# Webob uses legacy-cgi and so our tests need it too for cgi.FieldStorage, maybe webob 2 will remove it? https://github.com/Pylons/webob/pull/466 +legacy-cgi ; python_full_version >= '3.13' # for faster resp.html parsing in tests lxml Markdown
