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

Move the global file_fields variable at the top of workbench_utils.py to a configuration setting #907

Open
mjordan opened this issue Feb 25, 2025 · 1 comment
Assignees
Labels
code cleanup Clean up code, including code-level comments

Comments

@mjordan
Copy link
Owner

mjordan commented Feb 25, 2025

No need for it to be a global variable. Also, putting it in a config setting will allow users who have custom media types to add their own file field names.

@mjordan mjordan added the code cleanup Clean up code, including code-level comments label Feb 25, 2025
@mjordan mjordan self-assigned this Feb 25, 2025
@mjordan
Copy link
Owner Author

mjordan commented Feb 25, 2025

Welp, turns out we already have a config setting media_type_file_fields, which has a default of:

            {
                "file": "field_media_file",
                "document": "field_media_document",
                "image": "field_media_image",
                "audio": "field_media_audio_file",
                "video": "field_media_video_file",
                "extracted_text": "field_media_file",
                "fits_technical_metadata": "field_media_file",
                "remote_video": "field_media_oembed_video",
            }

This config setting is only changed if using a custom media type that isn't in the list above. Therefore, we can replace file_fields with a list of values from the above default setting and document how to use it in various tasks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code cleanup Clean up code, including code-level comments
Projects
None yet
Development

No branches or pull requests

1 participant