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

static_url with a prefix does not work in a Template tag #3350

Closed
joesolly opened this issue Nov 20, 2023 · 2 comments
Closed

static_url with a prefix does not work in a Template tag #3350

joesolly opened this issue Nov 20, 2023 · 2 comments

Comments

@joesolly
Copy link

when using the Celery UI Flower, I discovered that using the Template tag inside of a template results in the static_url function no longer working as expected. Specifically, it was not prepending the static_root to the resource requested.

It looks to me like static_url might not be loading at all and it might just be returning it's arguments. I believe that might stem from a Template creating it's own namespace here https://github.com/tornadoweb/tornado/blob/master/tornado/template.py#L339-L353 vs using the same namespace function from the global app defined here https://github.com/tornadoweb/tornado/blob/master/tornado/web.py#L1095-L1116 although I'm not entirely confident in that.

Here is the matching issue in Flower that I posted as well.
mher/flower#1338

@bdarnell
Copy link
Member

bdarnell commented Dec 2, 2023

By "Template tag", I assume you mean {% module Template(...) %}? I think you're right that that would lose the functions that are normally created by RequestHandler.get_template_namespace. That would definitely be a problem, but I'd expect the result to be an error when it tries to call the non-existent static_url function. I don't see any way for it to just return its arguments unmodified. Do you have a complete example of this problem?

@joesolly
Copy link
Author

joesolly commented Dec 5, 2023

@bdarnell thanks for the response. This issue stemmed from my debugging mher/flower#1338. However, the version of code I was reading (2.0.1), was different from the version I had installed (2.0.0), so static_url wasn't even being called in that old version. I had incorrectly assumed that static_url wasn't working, but it turns out it wasn't in the code I had installed at all. Sorry about the incorrect issue.

@joesolly joesolly closed this as completed Dec 5, 2023
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

No branches or pull requests

2 participants