Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make responding with binary data work under Py3. #122

Closed
wants to merge 5 commits into from

Conversation

albu-diku
Copy link

@albu-diku albu-diku commented Sep 24, 2024

The code as previously written would unconditionally encode parts as
though they contained text - this went unnoticed on PY2 because strings
and bytes are one and the same thing but blew up on PY3 where a string
is explicitly of type unicode while a binary file would be raw bytes.

Explicitly check the output_format and if instructed to serve a file do
so without touching the chunks of file content bytes being yielded.

Depends on: #140
Depends on: #175

@albu-diku albu-diku force-pushed the fix/wsgi_bin-file-py3 branch from edf2d29 to 2ede2ea Compare October 2, 2024 13:15
@albu-diku albu-diku marked this pull request as ready for review October 2, 2024 13:16
@albu-diku albu-diku force-pushed the fix/wsgi_bin-file-py3 branch from 2ede2ea to 46b5099 Compare October 2, 2024 13:25
@albu-diku albu-diku changed the base branch from test/migwsgi to edge October 2, 2024 13:25
@albu-diku albu-diku force-pushed the fix/wsgi_bin-file-py3 branch 2 times, most recently from c867116 to e9444d4 Compare October 2, 2024 16:51
@albu-diku albu-diku force-pushed the fix/wsgi_bin-file-py3 branch from e9444d4 to 3060801 Compare October 16, 2024 19:07
A previous revision fixed an immediate problem with test path handling
but knowingly left some things on the table - in particular a split
between container based handling of Python 2 and the local execution
of Python 3 (meaning a potentially inconsistent version relative to
what the project considers officially supported).

Address this entirely: rework the default behaviour of `make test` to
container based execution and use a consistent baseline Python 3.

In order to continue to support rapid local iteration, provide a
separate `make unittest` target which will execute the test suite
locally and is also used as a mechanism to run other supporting tools.

The clean use of containers necessitated various changes that make path
arguments within the testconfig non-overlapping and better isolated.
Adjust all paths generated within the test suite to be always from the
base root instead of relative the output directory. Opt to patch the
makeconfig generator rather than fiddle with generateconfs again.

While here also add support for an environment variable overried that
allows execution of the test suite against arbitrary python 3 versions.
@albu-diku albu-diku removed the rebased label Nov 12, 2024
Import the experimental branch version of force_utf8 wholesale adding a
-py(2|3) suffix and expose the correct implementation dependent on PY2.

Include forcing InputException messages to a native string as is done in
experimental (also taken directly from that branch) which ensures the
exception message, which may be unicode, becomes a string everywhere.
@albu-diku albu-diku force-pushed the fix/wsgi_bin-file-py3 branch from 3060801 to 5089682 Compare January 11, 2025 12:14
This PR does the principle things required to allow exercising the
central component responsible for glueing named MiG "functionality"
files to WSGI and have the result execute to completion under Python 3.

Included is a small tactical change to allow the structural force
recursive functions to iterate tuples preserving their type such that
subsequence output behaves correctly under Py3.

=======

wip

fixup

fixup

updare and relocate a comment

start tightening up the code

shift things around a little

work to make it readable with a nod towards further tests

assert the response status

allow programming the response

repair previous

assert that a programmed title ends up in the page

line naming up with other recent work in grid_openid

fixup

fixup

fixup

fixup

split the testing infrastructure across multiple files

collect common default kwargs

use noop for set environ

make the generic WSGI handling setup code more uniform

bring over improvements to hmtlsupp from another branch

simplify

fixup
The code as previously written would unconditionally encode parts as
though they contained text - this went unnoticed on PY2 because strings
and bytes are one and the same thing but blew up on PY3 where a string
is explicitly of type unicode while a binary file would be raw bytes.

Explicitly check the output_format and if instructed to serve a file do
so without touching the chunks of file content bytes being yielded.
@albu-diku albu-diku force-pushed the fix/wsgi_bin-file-py3 branch from 5089682 to 0270f09 Compare January 14, 2025 20:21
@albu-diku albu-diku closed this Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant