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

Pass a request object to custom page templates #738

Closed
simonw opened this issue Apr 26, 2020 · 1 comment
Closed

Pass a request object to custom page templates #738

simonw opened this issue Apr 26, 2020 · 1 comment
Labels

Comments

@simonw
Copy link
Owner

simonw commented Apr 26, 2020

Follow-up to #648. I'm not passing a request object to .render_template() at the moment, which breaks any other custom plugins using e.g. extra_template_vars() that were expecting to be able to access the request.

@simonw simonw added the small label Apr 26, 2020
@simonw
Copy link
Owner Author

simonw commented Apr 26, 2020

datasette/datasette/app.py

Lines 781 to 789 in 304e7b1

body = await self.ds.render_template(
template,
{
"custom_header": custom_header,
"custom_status": custom_status,
"custom_redirect": custom_redirect,
},
view_name="page",
)

request is an optional argument here:

datasette/datasette/app.py

Lines 556 to 558 in 304e7b1

async def render_template(
self, templates, context=None, request=None, view_name=None
):

@simonw simonw closed this as completed in 1b7b66c Apr 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant