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

Template rendering failure when installing theme plugin #975

Closed
ravikhetani opened this issue Jan 10, 2024 · 6 comments · Fixed by #1062
Closed

Template rendering failure when installing theme plugin #975

ravikhetani opened this issue Jan 10, 2024 · 6 comments · Fixed by #1062
Assignees
Labels
enhancement Enhancements will be processed by decreasing priority good first issue Good issue to tacke for first-time contributors

Comments

@ravikhetani
Copy link
Contributor

Bug description
Hi, I was trying to build the Openedx image with a theme plugin, and an exception was thrown in /tutor/tutor/env.py in the def render_template method, for fonts in my themes lms/static/fonts directory. My fonts are in the OpenType format (.otf). I can't see anything documented in the openedx documents, or tutor documents that suggests that OpenType fonts can't be used.

Having looked at env.py

BIN_FILE_EXTENSIONS = [".ico", ".jpg", ".patch", ".png", ".ttf", ".woff", ".woff2"]
, I can see that it's not included in the binary file extensions, preventing render_template from trying to render the fonts. Any reason why it's not included in the list of extensions?

How to reproduce
Add Opentype fonts to custom theme plugin, and try to build the openedx image

@regisb regisb added enhancement Enhancements will be processed by decreasing priority good first issue Good issue to tacke for first-time contributors labels Jan 11, 2024
@regisb
Copy link
Contributor

regisb commented Jan 12, 2024

Hi @ravikhetani! It should be easy enough to add the ".otf" extension to the BIN_FILE_EXTENSIONS. Alternatively, we could create a new filter were we would include all files that should be copied, and not rendered. This filter would include all the files with an extension in BIN_FILE_EXTENSIONS.

Would you like to open a PR? Ideally, we should implement both solutions, but feel free to tackle just one. If you'd rather not open a PR, we can take care of it.

@ravikhetani
Copy link
Contributor Author

@regisb I think yes to both - I'll submit a PR for the quick fix of adding it to the lest of extensions, but I think the filter is the proper solution, as I can imagine other supported image formats etc that people may want to add.

@regisb
Copy link
Contributor

regisb commented Jan 23, 2024

Closed by #985.

We still need to implement the file copying filter proposed here.

@regisb regisb closed this as completed Jan 23, 2024
@regisb regisb reopened this Jan 23, 2024
@Abdul-Muqadim-Arbisoft
Copy link
Contributor

@regisb I will work on making the file copying filter

@DawoudSheraz
Copy link
Contributor

@Abdul-Muqadim-Arbisoft Please add the details of the new PR and update the issue accordingly. Thank you

@Abdul-Muqadim-Arbisoft
Copy link
Contributor

This pull request introduces a new filter, IS_FILE_RENDERED, designed to enhance the flexibility of file handling within Tutor plugins. The new IS_FILE_RENDERED filter allows plugin developers to specify files that should not be rendered but instead copied . For our specific scenario we can add path to the respective .otf files through the filter we can return false for rendering it and it would only be copied

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancements will be processed by decreasing priority good first issue Good issue to tacke for first-time contributors
Projects
Development

Successfully merging a pull request may close this issue.

4 participants