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

Access to Django request from within the plugin #290

Open
db4y opened this issue Apr 9, 2021 · 3 comments
Open

Access to Django request from within the plugin #290

db4y opened this issue Apr 9, 2021 · 3 comments
Assignees

Comments

@db4y
Copy link

db4y commented Apr 9, 2021

Hi

I'm writing a custom check and I would need some informations contained in Django's request object in my check. I could not find a way to access the request nor to pass it to the plugin.

Is it possible to access the request from the plugin?

Thank you.

@skarzi
Copy link
Contributor

skarzi commented Apr 9, 2021

Hi 👋

I'm afraid it's not possible because CheckMixin that is subclassed in MainView doesn't pass the request object down to plugins run_check calls.
So the only way is to rewrite this package flow or (personally I dislike this solution) use some middleware to set currently handled request to some global variable

@db4y
Copy link
Author

db4y commented Apr 9, 2021

Thank you for the quick answer @skarzi
Do you think it would be possible to add this feature to the package? I would be willing to help.

@codingjoe
Copy link
Collaborator

Yes, it would be 😉 If you want to contribute this feature I'd be happy to review it. Best, Joe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants