Skip to content

The import_content code no longer runs as a script#11

Merged
PaulWay merged 2 commits intomainfrom
advisor_import_content_not_run_as_script
Jul 15, 2025
Merged

The import_content code no longer runs as a script#11
PaulWay merged 2 commits intomainfrom
advisor_import_content_not_run_as_script

Conversation

@PaulWay
Copy link
Collaborator

@PaulWay PaulWay commented Jul 15, 2025

Previously, the api/scripts/import_content.py script was expected to run by
itself and read files from the operating system. This is no longer supported.
However, the legacy of this was that we tried to manually set up the Django
environment, something that is now confusing parts of the WSGI loader. This
manual setup can easily be removed.

PaulWay added 2 commits July 15, 2025 15:10
Signed-off-by: Paul Wayper <paulway@redhat.com>
Signed-off-by: Paul Wayper <paulway@redhat.com>
@PaulWay
Copy link
Collaborator Author

PaulWay commented Jul 15, 2025

Fixes RHINENG-17934

@PaulWay PaulWay self-assigned this Jul 15, 2025
@PaulWay PaulWay added bug Something isn't working Advisor The 'Advisor' component of the code. API The API components of both Advisor and Tasks labels Jul 15, 2025
Copy link
Collaborator

@mhuth mhuth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, I didn't realize those files were not needed at all!

# Data is not valid for some reason.
return HttpResponseBadRequest("Config or content fields were not present")
return HttpResponseBadRequest(
content=b"Config or content fields were not present"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any requirement to convert the strings to bytes?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the content sent by the HttpResponseBadRequest and other responses is in bytes; Django's been silently handling the conversion but this showed up in my type checking in Zed.

@PaulWay PaulWay merged commit ae50ab1 into main Jul 15, 2025
PaulWay added a commit that referenced this pull request Jul 15, 2025
Previously, the `api/scripts/import_content.py` script was expected to run by
itself and read files from the operating system. This is no longer supported.
However, the legacy of this was that we tried to manually set up the Django
environment, something that is now confusing parts of the WSGI loader. This
manual setup can easily be removed.

Signed-off-by: Paul Wayper <paulway@redhat.com>
PaulWay added a commit that referenced this pull request Jul 16, 2025
Previously, the `api/scripts/import_content.py` script was expected to run by
itself and read files from the operating system. This is no longer supported.
However, the legacy of this was that we tried to manually set up the Django
environment, something that is now confusing parts of the WSGI loader. This
manual setup can easily be removed.

Signed-off-by: Paul Wayper <paulway@redhat.com>
PaulWay added a commit that referenced this pull request Aug 8, 2025
Previously, the `api/scripts/import_content.py` script was expected to run by
itself and read files from the operating system. This is no longer supported.
However, the legacy of this was that we tried to manually set up the Django
environment, something that is now confusing parts of the WSGI loader. This
manual setup can easily be removed.

Signed-off-by: Paul Wayper <paulway@redhat.com>
PaulWay added a commit that referenced this pull request Sep 15, 2025
Previously, the `api/scripts/import_content.py` script was expected to run by
itself and read files from the operating system. This is no longer supported.
However, the legacy of this was that we tried to manually set up the Django
environment, something that is now confusing parts of the WSGI loader. This
manual setup can easily be removed.

Signed-off-by: Paul Wayper <paulway@redhat.com>
PaulWay added a commit that referenced this pull request Feb 12, 2026
Previously, the `api/scripts/import_content.py` script was expected to run by
itself and read files from the operating system. This is no longer supported.
However, the legacy of this was that we tried to manually set up the Django
environment, something that is now confusing parts of the WSGI loader. This
manual setup can easily be removed.

Signed-off-by: Paul Wayper <paulway@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Advisor The 'Advisor' component of the code. API The API components of both Advisor and Tasks bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants