Bugzilla Automation <[email protected]> has asked freebsd-python (Nobody)
<[email protected]> for maintainer-feedback:
Bug 300270: www/py-flask-uploads: Fix import with Werkzeug 1.0+ (cannot import
name 'secure_filename')
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=300270



--- Description ---
flask_uploads cannot be imported with the tree's Werkzeug 3.1, on any
Python version (3.12, the current default, shown):

    $ python3.12 -c 'import flask_uploads'
    ImportError: cannot import name 'secure_filename' from 'werkzeug'
(/usr/local/lib/python3.12/site-packages/werkzeug/__init__.py)

flask_uploads.py:26 imports secure_filename and FileStorage from the
werkzeug top level. Werkzeug 1.0 removed those re-exports.

The patch imports them from werkzeug.utils and werkzeug.datastructures,
bumps PORTREVISION and gives the patch in files/ a header saying what it
does and its upstream status (Description, Issue ID, Changeset, TODO).

Misc changes:
- the port switches to USE_PYTHON=pep517 (the package metadata becomes
  dist-info)

Impact: no ports depend on it.

Tested: poudriere bulk -C -t on 14.5-RELEASE amd64 with Python 3.12:
builds, and flask_uploads imports from the built package; the package
code also imports on 3.13 and 3.14. With Werkzeug 3.1.8 and Flask
3.1.3, uploading a file, refusing a disallowed one and serving an
upload work on 3.12 and 3.13.

After the switch to USE_PYTHON=pep517, the package installs its metadata
as .dist-info, and the modules still import from the built package.

Upstream: 0.2.1 (2016-07-23) is the last release. The maintained
community fork is Flask-Reuploaded; switching the port to it would be
the long-term option.

Reply via email to